Term Font: Added full support for alacritty

This commit is contained in:
Dylan Araps 2017-01-08 10:24:04 +11:00
parent 9ab0f61524
commit 38825bfdc1
1 changed files with 42 additions and 40 deletions

View File

@ -1544,56 +1544,19 @@ get_term_font() {
case "$term" in case "$term" in
"alacritty"*) "alacritty"*)
term_font="$(awk -F ':|#' '/family:/ {print $2}' "${XDG_CONFIG_HOME}/alacritty.yml")" term_font="$(awk -F ':|#' '/normal:/ {getline; print}' "${XDG_CONFIG_HOME}/alacritty/alacritty.yml")"
;; term_font="${term_font/*family:}"
term_font="${term_font/$'\n'*}"
"urxvt" | "urxvtd" | "xterm")
term_font="$(grep -i -F "${term/d}*font" < <(xrdb -query))"
term_font="${term_font/*font:}"
term_font="$(trim "$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/:*}"
;;
"-"*) term_font="$(awk -F '\\-' '{printf $3}' <<< "$term_font")" ;;
esac
;;
"xfce4-terminal")
term_font="$(awk -F '=' '/^FontName/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc")"
;;
"termite")
term_font="$(awk -F '= ' '/^font/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/termite/config")"
;;
"mintty")
term_font="$(awk -F '=' '!/^($|#)/ && /Font/ {printf $2; exit}' "${HOME}/.minttyrc")"
;; ;;
"Apple_Terminal") "Apple_Terminal")
term_font="$(osascript -e 'tell application "Terminal" to font name of window frontmost')" term_font="$(osascript -e 'tell application "Terminal" to font name of window frontmost')"
;; ;;
"terminology")
term_font="$(strings "${XDG_CONFIG_HOME}/terminology/config/standard/base.cfg" | awk '/^font\.name$/{print a}{a=$0}')"
term_font="${term_font/.pcf}"
term_font="${term_font/:*}"
;;
"Hyper"*) "Hyper"*)
term_font="$(awk -F "," '/fontFamily/ {a=$1} END{print a}' "${HOME}/.hyper.js" | awk -F "'" '{a=$2} END{print a}')" term_font="$(awk -F "," '/fontFamily/ {a=$1} END{print a}' "${HOME}/.hyper.js" | awk -F "'" '{a=$2} END{print a}')"
;; ;;
"sakura"*)
term_font="$(awk -F '=' '/^font=/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/sakura/sakura.conf")"
;;
"konsole"*) "konsole"*)
# Get Process ID of current konsole window / tab # Get Process ID of current konsole window / tab
child="$(get_ppid "$$")" child="$(get_ppid "$$")"
@ -1616,6 +1579,45 @@ get_term_font() {
profile_filename="${profile_filename/$'\n'*}" profile_filename="${profile_filename/$'\n'*}"
[[ "$profile_filename" ]] && term_font="$(awk -F '=|,' '/Font=/ {print $2 " " $3}' "$profile_filename")" [[ "$profile_filename" ]] && term_font="$(awk -F '=|,' '/Font=/ {print $2 " " $3}' "$profile_filename")"
;; ;;
"mintty")
term_font="$(awk -F '=' '!/^($|#)/ && /Font/ {printf $2; exit}' "${HOME}/.minttyrc")"
;;
"sakura"*)
term_font="$(awk -F '=' '/^font=/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/sakura/sakura.conf")"
;;
"terminology")
term_font="$(strings "${XDG_CONFIG_HOME}/terminology/config/standard/base.cfg" | awk '/^font\.name$/{print a}{a=$0}')"
term_font="${term_font/.pcf}"
term_font="${term_font/:*}"
;;
"termite")
term_font="$(awk -F '= ' '/^font/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/termite/config")"
;;
"urxvt" | "urxvtd" | "xterm")
term_font="$(grep -i -F "${term/d}*font" < <(xrdb -query))"
term_font="${term_font/*font:}"
term_font="$(trim "$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/:*}"
;;
"-"*) term_font="$(awk -F '\\-' '{printf $3}' <<< "$term_font")" ;;
esac
;;
"xfce4-terminal")
term_font="$(awk -F '=' '/^FontName/ {a=$2} END{print a}' "${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc")"
;;
esac esac
} }