From 4b684c0eb644eea3489e329bcfcd543bd0f72da4 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 19:28:46 +1000 Subject: [PATCH] term_font: cleanup konsole --- neofetch | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index ce1743d3..9d9d31c6 100755 --- a/neofetch +++ b/neofetch @@ -2874,13 +2874,14 @@ END # Get Process ID of current konsole window / tab child="$(get_ppid "$$")" - konsole_instances=($(qdbus | grep 'org.kde.konsole')) + IFS=$'\n' read -d "" -ra konsole_instances < <(qdbus | grep -F 'org.kde.konsole') for i in "${konsole_instances[@]}"; do - konsole_sessions=($(qdbus "${i}" | grep '/Sessions/')) + IFS=$'\n' read -d "" -ra konsole_sessions < <(qdbus "$i" | grep -F '/Sessions/') + for session in "${konsole_sessions[@]}"; do - if ((child == "$(qdbus "${i}" "${session}" processId)")); then - profile="$(qdbus "${i}" "${session}" environment |\ + if ((child == "$(qdbus "$i" "$session" processId)")); then + profile="$(qdbus "$i" "$session" environment |\ awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')" break fi @@ -2889,8 +2890,9 @@ END done # We could have two profile files for the same profile name, take first match - profile_filename="$(grep -l "Name=${profile}" "${HOME}"/.local/share/konsole/*.profile)" + profile_filename="$(grep -l "Name=${profile}" "$HOME"/.local/share/konsole/*.profile)" profile_filename="${profile_filename/$'\n'*}" + [[ "$profile_filename" ]] && \ term_font="$(awk -F '=|,' '/Font=/ {print $2 " " $3}' "$profile_filename")" ;;