From 0fe972073f533ac99e6d4fae7bda0acd1dfc4017 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 21 May 2018 08:24:32 +1000 Subject: [PATCH] image: Cleanup of get_term_size --- neofetch | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index 15eed8ac..5bd1203e 100755 --- a/neofetch +++ b/neofetch @@ -3686,13 +3686,8 @@ get_term_size() { term_width="${term_size[2]/t*}" fi - # If the sequences above don't work and the user is on a macOS system - # or a system not running an X server, return early. - [[ -z "$DISPLAY" ]] && \ - { term_width=0; return; } - # Get terminal width/height if \e[14t is unsupported. - if [[ -z "$term_width" ]] || (( "$term_width" < 50 )); then + if (( "${term_width:-0}" < 50 )) && [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then if type -p xdotool >/dev/null 2>&1; then current_window="$(xdotool getactivewindow)" source <(xdotool getwindowgeometry --shell "$current_window") @@ -3715,13 +3710,11 @@ get_term_size() { awk -F ': ' '/Width|Height/ {printf $2 " "}')" term_width="${term_size/ *}" term_height="${term_size/${term_width}}" - else - term_width=0 fi - else - term_width=0 fi fi + + term_width="${term_width:-0}" } get_image_size() {