From 68645339d33e52197cf99201375e0411d5c33b33 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 15 Jan 2019 19:56:37 +0200 Subject: [PATCH 1/4] general: fix image sizing in VTE terminals. --- neofetch | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/neofetch b/neofetch index 64c75f6e..75304a11 100755 --- a/neofetch +++ b/neofetch @@ -3599,49 +3599,10 @@ get_w3m_img_path() { get_window_size() { # This functions gets the current window size in # pixels. - # - # We first try to use the escape sequence "\033[14t" - # to get the terminal window size in pixels. If this - # fails we then fallback to using "xdotool" or other - # programs. - - # Tmux has a special way of reading escape sequences - # so we have to use a slightly different sequence to - # get the terminal size. - if [[ "$image_backend" == "tycat" ]]; then - printf '%b' '\e}qs\000' - - else - case "${TMUX:-null}" in - "null") printf '%b' '\e[14t' ;; - *) printf '%b' '\ePtmux;\e\e[14t\e\\ ' ;; - esac - fi - - # The escape codes above print the desired output as - # user input so we have to use read to store the out - # -put as a variable. - # The 1 second timeout is required for older bash - case "${BASH_VERSINFO[0]}" in - 4|5) IFS=';t' read -d t -t 0.05 -sra term_size ;; - *) IFS=';t' read -d t -t 1 -sra term_size ;; - esac - unset IFS - - # Split the string into height/width. - if [[ "$image_backend" == "tycat" ]]; then - term_width="$((term_size[2] * term_size[0]))" - term_height="$((term_size[3] * term_size[1]))" - - else - term_height="${term_size[1]}" - term_width="${term_size[2]}" - fi - - [[ "$image_backend" == "kitty" ]] && \ + [[ "$image_backend" == "kitty" ]] && IFS=x read -r term_width term_height < <(kitty +kitten icat --print-window-size) - # Get terminal width/height if \e[14t is unsupported. + # Get terminal width/heigh. if (( "${term_width:-0}" < 50 )) && [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then if type -p xdotool &>/dev/null; then IFS=$'\n' read -d "" -ra win < <(xdotool getactivewindow getwindowgeometry --shell %1) From 5b301c773bf52ff5a27802ff2cce268e51aa341c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 15 Jan 2019 19:58:32 +0200 Subject: [PATCH 2/4] docs: update --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 75304a11..208aea4b 100755 --- a/neofetch +++ b/neofetch @@ -3602,7 +3602,7 @@ get_window_size() { [[ "$image_backend" == "kitty" ]] && IFS=x read -r term_width term_height < <(kitty +kitten icat --print-window-size) - # Get terminal width/heigh. + # Get terminal width/height. if (( "${term_width:-0}" < 50 )) && [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then if type -p xdotool &>/dev/null; then IFS=$'\n' read -d "" -ra win < <(xdotool getactivewindow getwindowgeometry --shell %1) From c7c1cf59ecbe3a27b16331fad9596a339554f34b Mon Sep 17 00:00:00 2001 From: Crestwave Date: Wed, 6 Feb 2019 08:02:49 +0000 Subject: [PATCH 3/4] packages: Specify Haiku's pkgman --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index eeb70f23..fe1cc368 100755 --- a/neofetch +++ b/neofetch @@ -1389,7 +1389,7 @@ get_packages() { ;; "Haiku") - dir /boot/system/package-links/* + has "pkgman" && dir /boot/system/package-links/* ;; "IRIX") From 6f423e3970183dcb86c64a7803ad97cb304538fe Mon Sep 17 00:00:00 2001 From: Sibren Vasse Date: Thu, 7 Feb 2019 23:48:09 +0100 Subject: [PATCH 4/4] Robuster kitty font parsing --- neofetch | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/neofetch b/neofetch index fe1cc368..27e320c7 100755 --- a/neofetch +++ b/neofetch @@ -2912,10 +2912,7 @@ END kitty_config="$(kitty --debug-config)" [[ "$kitty_config" != *font_family* ]] && return - 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" + term_font="$(awk '/^font_family|^font_size/ {printf $2 " "}' <<< "$kitty_config")" ;; "konsole" | "yakuake")