Merge pull request #580 from mstraube/konsole
Term: Rewrite Konsole font detection, closes #576
This commit is contained in:
commit
febc465345
1 changed files with 16 additions and 15 deletions
31
neofetch
31
neofetch
|
@ -1587,25 +1587,26 @@ get_term_font() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"konsole"*)
|
"konsole"*)
|
||||||
# Use Process ID from get_term().
|
# Get Process ID of current konsole window / tab
|
||||||
# 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 "$$")"
|
child="$(get_ppid "$$")"
|
||||||
|
|
||||||
# Get all konsole sessions of the parent (all child windows and tabs)
|
konsole_instances=($(qdbus | grep 'org.kde.konsole'))
|
||||||
konsole_sessions=($(qdbus org.kde.konsole-"${parent}" | awk '/Sessions\//'))
|
|
||||||
|
|
||||||
# Get profile of current session (window / tab)
|
for i in "${konsole_instances[@]}"; do
|
||||||
for session in "${konsole_sessions[@]}"; do
|
konsole_sessions=($(qdbus "${i}" | grep '/Sessions/'))
|
||||||
if ((child == "$(qdbus org.kde.konsole-"${parent}" "${session}" processId)")); then
|
for session in "${konsole_sessions[@]}"; do
|
||||||
profile="$(qdbus org.kde.konsole-"${parent}" "${session}" environment | awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')"
|
if ((child == "$(qdbus "${i}" "${session}" processId)")); then
|
||||||
break
|
profile="$(qdbus "${i}" "${session}" environment | awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')"
|
||||||
fi
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[[ "$profile" ]] && break
|
||||||
done
|
done
|
||||||
term_font="$(awk -F '=|,' '/Font=/ {print $2}' "${HOME}/.local/share/konsole/${profile}".profile)"
|
|
||||||
|
# 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="${profile_filename/$'\n'*}"
|
||||||
|
[[ "$profile_filename" ]] && term_font="$(awk -F '=|,' '/Font=/ {print $2 " " $3}' "$profile_filename")"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue