neofetch: Fix urxvt font, closes #1253

This commit is contained in:
Dylan Araps 2019-10-30 12:25:33 +00:00
parent 1c9db4af1a
commit 9bb236eb4b
No known key found for this signature in database
GPG key ID: 46D62DD9F1DE636E

View file

@ -3186,32 +3186,32 @@ END
"$termite_config")"
;;
"urxvt" | "urxvtd" | "rxvt-unicode" | "xterm")
xrdb="$(xrdb -query)"
term_font="$(grep -im 1 -e "^${term/d}"'\**\.*font' -e '^\*font' <<< "$xrdb")"
term_font="${term_font/*"*font:"}"
term_font="${term_font/*".font:"}"
term_font="${term_font/*"*.font:"}"
term_font="$(trim "$term_font")"
urxvt|urxvtd|rxvt-unicode|xterm)
xrdb=$(xrdb -query)
term_font=$(grep -im 1 -e "^${term/d}"'\**\.*font:' -e '^\*font:' <<< "$xrdb")
term_font=${term_font/*"*font:"}
term_font=${term_font/*".font:"}
term_font=${term_font/*"*.font:"}
term_font=$(trim "$term_font")
[[ -z "$term_font" && "$term" == "xterm" ]] && \
term_font="$(grep '^XTerm.vt100.faceName' <<< "$xrdb")"
[[ -z $term_font && $term == xterm ]] && \
term_font=$(grep '^XTerm.vt100.faceName' <<< "$xrdb")
term_font="$(trim "${term_font/*"faceName:"}")"
term_font=$(trim "${term_font/*"faceName:"}")
# xft: isn't required at the beginning so we prepend it if it's missing
[[ "${term_font:0:1}" != "-" && "${term_font:0:4}" != "xft:" ]] && \
term_font="xft:$term_font"
[[ ${term_font:0:1} != '-' && ${term_font:0:4} != xft: ]] && \
term_font=xft:$term_font
# Xresources has two different font formats, this checks which
# one is in use and formats it accordingly.
case $term_font in
*"xft:"*)
term_font="${term_font/xft:}"
term_font="${term_font/:*}"
*xft:*)
term_font=${term_font/xft:}
term_font=${term_font/:*}
;;
"-"*)
-*)
IFS=- read -r _ _ term_font _ <<< "$term_font"
;;
esac