image: Cleanup of get_term_size
This commit is contained in:
parent
fc229704c8
commit
0fe972073f
15
neofetch
15
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
|
||||
fi
|
||||
|
||||
term_width="${term_width:-0}"
|
||||
}
|
||||
|
||||
get_image_size() {
|
||||
|
|
Reference in New Issue