From 5e27e5ba97ad9718c9d077230ba3c44d08ac65dc Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 24 Dec 2016 11:46:14 +0100 Subject: [PATCH] Font: Add support for Konsole --- neofetch | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/neofetch b/neofetch index a2bc1c75..69f6b912 100755 --- a/neofetch +++ b/neofetch @@ -1602,6 +1602,28 @@ get_term_font() { "sakura"*) term_font="$(awk -F '=' '/^font=/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/sakura/sakura.conf")" ;; + + "konsole"*) + # Use Process ID from get_term(). + # The variable can include 'PPid:' and also whitespace + # so we get rid of it here. + parent="$(trim "${parent/PPid:}")" + + # Get PID of current child window / tab + child="$(get_ppid "$$")" + + # Get all konsole sessions of the parent (all child windows and tabs) + konsole_sessions=($(qdbus org.kde.konsole-"${parent}" | awk '/Sessions\//')) + + # Get profile of current session (window / tab) + for session in "${konsole_sessions[@]}"; do + if ((child == "$(qdbus org.kde.konsole-"${parent}" "${session}" processId)")); then + profile="$(qdbus org.kde.konsole-"${parent}" "${session}" environment | awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')" + break + fi + done + term_font="$(awk -F '=|,' '/Font=/ {print $2}' "${HOME}/.local/share/konsole/${profile}".profile)" + ;; esac }