misc: cleanup

This commit is contained in:
Dylan Araps 2018-06-03 17:07:04 +10:00
parent 96bd33c2a0
commit 55b3925a29

View file

@ -946,9 +946,9 @@ get_distro() {
"on") distro="${distro/ ${osx_build}}" ;; "on") distro="${distro/ ${osx_build}}" ;;
"tiny") "tiny")
case "$osx_version" in case "$osx_version" in
"10."[4-7]*) distro="${distro/${codename}/Mac OS X}" ;; "10."[4-7]*) distro="${distro/${codename}/Mac OS X}" ;;
"10."[8-9]* | "10.1"[0-1]*) distro="${distro/${codename}/OS X}" ;; "10."[8-9]* | "10.1"[0-1]*) distro="${distro/${codename}/OS X}" ;;
"10.1"[2-3]*) distro="${distro/${codename}/macOS}" ;; "10.1"[2-3]*) distro="${distro/${codename}/macOS}" ;;
esac esac
distro="${distro/ ${osx_build}}" distro="${distro/ ${osx_build}}"
;; ;;
@ -1146,7 +1146,7 @@ get_kernel() {
if [[ "$os" =~ (BSD|MINIX) && "$distro" == *"$kernel_name"* ]]; then if [[ "$os" =~ (BSD|MINIX) && "$distro" == *"$kernel_name"* ]]; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on" | "tiny") kernel="$kernel_version" ;; "on" | "tiny") kernel="$kernel_version" ;;
*) unset kernel ;; *) unset kernel ;;
esac esac
fi fi
} }
@ -1415,7 +1415,7 @@ get_de() {
# the desktop variables are sometimes also set to the # the desktop variables are sometimes also set to the
# window manager name. This checks to see if WM == DE # window manager name. This checks to see if WM == DE
# and dicards the DE value. # and dicards the DE value.
[[ "$wm" && "$de" =~ ^$wm$ ]] && { unset -v de; return; } [[ "$de" == "$wm" ]] && { unset -v de; return; }
;; ;;
esac esac
@ -3302,7 +3302,7 @@ get_cols() {
printf -v block_spaces "%${block_height}s" printf -v block_spaces "%${block_height}s"
# Convert the spaces into rows of blocks. # Convert the spaces into rows of blocks.
[[ "$blocks" ]] && cols+="${block_spaces// /${blocks}${reset}nl}" [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}${reset}nl}"
[[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}${reset}nl}" [[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}${reset}nl}"
# Add newlines to the string. # Add newlines to the string.
@ -3620,10 +3620,9 @@ get_image_size() {
read -r width height <<< "$(identify -format "%w %h" "$image")" read -r width height <<< "$(identify -format "%w %h" "$image")"
crop_mode="none" crop_mode="none"
while (( "$width" >= ("$term_width" / 2) || while ((width >= (term_width / 2) || height >= term_height)); do
"$height" >= "$term_height" )); do ((width=width/2))
width="$((width / 2))" ((height=height/2))
height="$((height / 2))"
done done
;; ;;
@ -3785,13 +3784,8 @@ display_image() {
} }
to_ascii() { to_ascii() {
# Log the error.
err "$1" err "$1"
# This function makes neofetch fallback to ascii mode.
image_backend="ascii" image_backend="ascii"
# Print the ascii art.
get_ascii get_ascii
# Set cursor position next image/ascii. # Set cursor position next image/ascii.
@ -3799,7 +3793,6 @@ to_ascii() {
} }
to_off() { to_off() {
# This function makes neofetch fallback to off mode.
err "$1" err "$1"
image_backend="off" image_backend="off"
text_padding= text_padding=