From b1402c0372164139b3790ab49c4c858dba3659d4 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 16 May 2016 21:35:29 +1000 Subject: [PATCH] Foundations for terminal font support --- neofetch | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 1c7048f3..4eba3793 100755 --- a/neofetch +++ b/neofetch @@ -56,7 +56,8 @@ printinfo () { info "WM Theme" wmtheme info "Theme" theme info "Icons" icons - info "Font" font + info "Terminal Emulator" term + info "Terminal Font" termfont info "CPU" cpu info "GPU" gpu info "Memory" memory @@ -1734,6 +1735,38 @@ getfont () { # }}} +# Terminal Emulator {{{ + +getterm () { + parent="$(ps -p ${1:-$PPID} -o ppid=)" + name="$(ps -p $parent -o comm=)" + + case "$name" in + "${SHELL/*\/}" | *"sh") getterm "$parent" ;; + *) term="$name" ;; + esac +} + +# }}} + +# Terminal Emulator Font {{{ + +gettermfont () { + [ -z "$term" ] && getterm + + case "$term" in + "urxvt"*) + # Need to figure out how to best parse the Xresources file. + ;; + + "xfce4-terminal") + termfont="$(awk -F '=' '/FontName/ {printf $2}' "${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc")" + ;; + esac +} + +# }}} + # Disk Usage {{{ getdisk () {