Add font detection for iTerm2
This commit is contained in:
parent
1af650eaf1
commit
e9c8e6c2a3
19
neofetch
19
neofetch
|
@ -1644,6 +1644,25 @@ get_term_font() {
|
||||||
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')"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"iTerm2")
|
||||||
|
local currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window')
|
||||||
|
|
||||||
|
# Count Guids in "New Bookmarks"; they should be unique
|
||||||
|
local profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist | grep "Guid" | wc -l)
|
||||||
|
for idx in $(seq 0 ${profilesCount}); do
|
||||||
|
local profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||||
|
if [[ "${profileName}" == "${currentProfileName}" ]]; then
|
||||||
|
# "Normal Font"
|
||||||
|
term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||||
|
# Font for non-ascii characters
|
||||||
|
local nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)
|
||||||
|
if [[ "$term_font" -ne "$nonAsciiFont" ]]; then
|
||||||
|
term_font="$term_font (normal) / $nonAsciiFont (non-ascii)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
"deepin-terminal"*)
|
"deepin-terminal"*)
|
||||||
term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END{print a " " b}' "${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")"
|
term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END{print a " " b}' "${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")"
|
||||||
;;
|
;;
|
||||||
|
|
Reference in New Issue