general: cleanup

This commit is contained in:
Dylan Araps 2018-04-14 08:40:28 +10:00
parent 91f8ba7a1f
commit 55de3a4201

View file

@ -2189,12 +2189,12 @@ END
;; ;;
"st") "st")
[[ -z "$parent" ]] && parent="$(get_ppid "$PPID")"
term_font="$(ps -o command= -p "$parent" | grep -F -- "-f")" term_font="$(ps -o command= -p "$parent" | grep -F -- "-f")"
if [[ "$term_font" ]]; then if [[ "$term_font" ]]; then
term_font="${term_font/*-f/}" term_font="${term_font/*-f/}"
term_font="${term_font/ -*/}" term_font="${term_font/ -*/}"
else else
# On Linux we can get the exact path to the running binary through the procfs # On Linux we can get the exact path to the running binary through the procfs
# (in case `st` is launched from outside of $PATH) on other systems we just # (in case `st` is launched from outside of $PATH) on other systems we just
@ -2206,8 +2206,11 @@ END
# Technically "Font Name" is a valid font. As it doesn't specify any font options # 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. # though it is hard to match it correctly amongst the rest of the noise.
[[ -n "$binary" ]] && \ [[ -n "$binary" ]] && \
term_font="$(strings "$binary" | \ term_font="$(strings "$binary" | grep -F -m 1 \
grep -F -m 1 -e "pixelsize=" -e "size=" -e "antialias=" -e "autohint=")" -e "pixelsize=" \
-e "size=" \
-e "antialias=" \
-e "autohint=")"
fi fi
term_font="${term_font/xft:}" term_font="${term_font/xft:}"