From 380e793c62178d1ef5c36be755d24ee973cdc8ce Mon Sep 17 00:00:00 2001 From: Aidan Harris Date: Mon, 2 Apr 2018 01:07:43 +0100 Subject: [PATCH] Correctly handle XTerm.vt100.faceName --- neofetch | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 8bebbaa6..a963a16d 100755 --- a/neofetch +++ b/neofetch @@ -2183,12 +2183,25 @@ END ;; "urxvt" | "urxvtd" | "rxvt-unicode" | "xterm") - term_font="$(grep -i "${term/d}\**\.*font" < <(xrdb -query))" + xrdb="$(xrdb -query)" + term_font="$(grep -i "${term/d}\**\.*font" <<< "$xrdb")" term_font="${term_font/*"*font:"}" term_font="${term_font/*".font:"}" term_font="${term_font/*"*.font:"}" term_font="$(trim "$term_font")" + if [[ -z "$term_font" && "$term" == "xterm" ]]; then + term_font="$(grep -E '^XTerm.vt100.faceName' <<< "$xrdb")" + term_font="${term_font/*"faceName:"}" + term_font="$(trim "$term_font")" + fi + + # xft: isn't required at the beginning so we prepend it if it's missing + if [[ "${term_font:0:1}" != "-" && \ + "${term_font:0:4}" != "xft:" ]]; then + term_font="xft:$term_font" + fi + # Xresources has two different font formats, this checks which # one is in use and formats it accordingly. case "$term_font" in