From 4b9ccc33bf9279b9bcb575f5088d0a139aeef71e Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 3 Feb 2019 01:36:22 +0100 Subject: [PATCH 1/8] Fix issues with debug/fonts script in Konsole --- debug/font-issues.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index 82f8e60b..6b505d36 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -222,13 +222,13 @@ END # Get Process ID of current konsole window / tab child="$(get_ppid "$$")" - IFS=$'\n' read -d "" -ra konsole_instances < <(qdbus | grep -F 'org.kde.konsole') + declare -a konsole_instances; konsole_instances=( "${(@f)"$(qdbus | grep -F 'org.kde.konsole')"/ /}" ) for i in "${konsole_instances[@]}"; do - IFS=$'\n' read -d "" -ra konsole_sessions < <(qdbus "$i" | grep -F '/Sessions/') + declare -a konsole_sessions; konsole_sessions=( "${(@f)"$(qdbus "$i" | grep -F '/Sessions/')"}" ) for session in "${konsole_sessions[@]}"; do - if ((child == "$(qdbus "$i" "$session" processId)")); then + if ((child == $(qdbus "$i" "$session" processId))); then profile="$(qdbus "$i" "$session" environment |\ awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')" break From 0081152c28edb96bd12d943803cd01cc5ac6e497 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 3 Feb 2019 08:35:46 +0100 Subject: [PATCH 2/8] Fix parsing font for Kitty --- debug/font-issues.zsh | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index 6b505d36..6b663514 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -201,21 +201,13 @@ END ;; "kitty"*) - shopt -s nullglob - confs=({$KITTY_CONFIG_DIRECTORY,$XDG_CONFIG_HOME,~/Library/Preferences}/kitty/kitty.con?) - shopt -u nullglob - - [[ -f "${confs[0]}" ]] || return + kitty_config="$(kitty --debug-config)" + [[ "$kitty_config" != *font_family* ]] && return - term_font="$(awk '/^([[:space:]]*|[^#_])font_family[[:space:]]+/ { - $1 = ""; - gsub(/^[[:space:]]/, ""); - font = $0 - } - /^([[:space:]]*|[^#_])font_size[[:space:]]+/ { - size = $2 - } - END { print font " " size}' "${confs[0]}")" + term_font_size="${kitty_config/*font_size}" + term_font_size="${term_font_size/$'\n'*}" + term_font="${kitty_config/*font_family}" + term_font="${term_font/$'\n'*} $term_font_size" ;; "konsole"*) From 933e95d31c0fec2fbd3e4e3151337ac8293d7d49 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 3 Feb 2019 08:41:32 +0100 Subject: [PATCH 3/8] Use Konsole/Yakuake detection from upstream --- debug/font-issues.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index 6b663514..c97ea34d 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -210,7 +210,7 @@ END term_font="${term_font/$'\n'*} $term_font_size" ;; - "konsole"*) + "konsole" | "yakuake") # Get Process ID of current konsole window / tab child="$(get_ppid "$$")" @@ -234,7 +234,7 @@ END profile_filename="${profile_filename/$'\n'*}" [[ "$profile_filename" ]] && \ - term_font="$(awk -F '=|,' '/Font=/ {print $2 " " $3}' "$profile_filename")" + term_font="$(awk -F '=|,' '/Font=/ {print $2,$3}' "$profile_filename")" ;; "lxterminal"*) From d83aacfb3ff01bf1839cf23e96ac9e6878663daa Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 9 Oct 2018 20:05:38 +0200 Subject: [PATCH 4/8] Fix font-debugging script for alacritty --- debug/font-issues.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index c97ea34d..135a6349 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -118,13 +118,13 @@ get_term_font() { 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/\#*}" From 0207182eb900a812ed42f47feadc7e24f43960ba Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 4 Dec 2018 08:28:07 +0100 Subject: [PATCH 5/8] Add missing function --- debug/font-issues.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index 135a6349..9fd9be15 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 From cdf3fa51f21d3ec39cc9a54a9e6271dab11c8741 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 4 Dec 2018 08:28:27 +0100 Subject: [PATCH 6/8] Make variables optional --- debug/font-issues.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index 9fd9be15..7435e9fe 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -119,6 +119,7 @@ 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 From 2fbdb8c982db7af4bec91ed6569351b18d5325b4 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 4 Dec 2018 08:32:04 +0100 Subject: [PATCH 7/8] Mute errors when detecting font --- debug/font-issues.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index 7435e9fe..dfd1f90e 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -163,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)" From 0334f4c2659f413eb38ca52037c00d3823745d35 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 3 Feb 2019 08:58:46 +0100 Subject: [PATCH 8/8] Merge from upstream --- debug/font-issues.zsh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/debug/font-issues.zsh b/debug/font-issues.zsh index dfd1f90e..5712fc6d 100755 --- a/debug/font-issues.zsh +++ b/debug/font-issues.zsh @@ -192,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