term_font: cleanup konsole

This commit is contained in:
Dylan Araps 2018-05-31 19:28:46 +10:00
parent ea7512da2f
commit 4b684c0eb6
1 changed files with 7 additions and 5 deletions

View File

@ -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")"
;;