diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index 82f8e60b..5712fc6d 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -16,6 +16,12 @@ trim() { set +f } +trim_quotes() { + trim_output="${1//\'}" + trim_output="${trim_output//\"}" + printf "%s" "$trim_output" +} + get_ppid() { # Get parent process ID of PID. case "$os" in @@ -113,18 +119,19 @@ get_term() { } get_term_font() { + local confs term_font mateterm_config role profile xrdb child profile_filename local term="${1}" # ((term_run != 1)) && get_term case "$term" in "alacritty"*) - shopt -s nullglob + setopt nullglob confs=({$XDG_CONFIG_HOME,$HOME}/{alacritty,}/{.,}alacritty.ym?) - shopt -u nullglob + unsetopt nullglob - [[ -f "${confs[0]}" ]] || return + [[ -f "${confs[1]}" ]] || return - term_font="$(awk -F ':|#' '/normal:/ {getline; print}' "${confs[0]}")" + term_font="$(awk -F ':|#' '/normal:/ {getline; print}' "${confs[1]}")" term_font="${term_font/*family:}" term_font="${term_font/$'\n'*}" term_font="${term_font/\#*}" @@ -156,26 +163,26 @@ END font_file="${HOME}/Library/Preferences/com.googlecode.iterm2.plist" # Count Guids in "New Bookmarks"; they should be unique - profiles_count="$(/usr/libexec/PlistBuddy -c "Print ':New Bookmarks:'" "$font_file" | \ + profiles_count="$(/usr/libexec/PlistBuddy -c "Print ':New Bookmarks:'" "$font_file" 2>/dev/null | \ grep -w -c "Guid")" for ((i=0; i/dev/null)" if [[ "$profile_name" == "$current_profile_name" ]]; then # "Normal Font" term_font="$(/usr/libexec/PlistBuddy -c "Print ':New Bookmarks:${i}:Normal Font:'" \ - "$font_file")" + "$font_file" 2>/dev/null)" # Font for non-ascii characters # Only check for a different non-ascii font, if the user checked # the "use a different font for non-ascii text" switch. diff_font="$(/usr/libexec/PlistBuddy -c "Print ':New Bookmarks:${i}:Use Non-ASCII Font:'" \ - "$font_file")" + "$font_file" 2>/dev/null)" if [[ "$diff_font" == "true" ]]; then non_ascii="$(/usr/libexec/PlistBuddy -c "Print ':New Bookmarks:${i}:Non Ascii Font:'" \ - "$font_file")" + "$font_file" 2>/dev/null)" [[ "$term_font" != "$non_ascii" ]] && \ term_font="$term_font (normal) / $non_ascii (non-ascii)" @@ -185,13 +192,13 @@ END ;; "deepin-terminal"*) - term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END {print a " " b}' \ + term_font="$(awk -F '=' '/font=/ {a=$2} /font_size/ {b=$2} END {print a,b}' \ "${XDG_CONFIG_HOME}/deepin/deepin-terminal/config.conf")" ;; "GNUstep_Terminal") term_font="$(awk -F '>|<' '/>TerminalFontTerminalFontSizeTerminalFontSize