diff --git a/neofetch b/neofetch index 2d649d88..c725aa78 100755 --- a/neofetch +++ b/neofetch @@ -1644,6 +1644,25 @@ get_term_font() { 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"*) term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END{print a " " b}' "${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")" ;;