Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

st xresources patch support #1877

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -3544,16 +3544,25 @@ END
# like a font definition. NOTE: There is a slight limitation in this approach.
# Technically "Font Name" is a valid font. As it doesn't specify any font options
# though it is hard to match it correctly amongst the rest of the noise.
[[ -n "$binary" ]] &&
term_font=$(
strings "$binary" |

grep -m 1 "*font[^2]"
)
st_bin=$(strings "$binary")

# Grab font information from strings in binary.
term_font=${term_font:-"$(
grep -F -m 1 \
-e "pixelsize=" \
-e "size=" \
-e "antialias=" \
-e "autohint=" <<< "$st_bin"
)"}

# Grab font information from Xresources.
[[ $st_bin == *resource* ]] && {
term_font=$(xrdb -query | grep -im 1 -e "^${term/d}"'\**\.*font:' -e '^\*font:' -e '^\*.font:')
term_font=$(trim "${term_font/*[\*.]"font:"}")
}
fi

term_font="${term_font/xft:}"
term_font="${term_font#*=}"
term_font="${term_font/:*}"
;;

Expand Down