Script is now twice as fast.
This commit is contained in:
parent
e733824ab7
commit
07eb2417e9
38
fetch.sh
38
fetch.sh
|
@ -487,18 +487,18 @@ getresolution () {
|
||||||
|
|
||||||
getcols () {
|
getcols () {
|
||||||
if [ "$color_blocks" == "on" ]; then
|
if [ "$color_blocks" == "on" ]; then
|
||||||
printf "%s" "${padding}"
|
printf "${padding}%s"
|
||||||
while [ $start -le $end ]; do
|
while [ $start -le $end ]; do
|
||||||
printf "%s%${block_width}s" "$(tput setab $start)"
|
printf "\e[48;5;${start}m%${block_width}s"
|
||||||
start=$((start + 1))
|
start=$((start + 1))
|
||||||
|
|
||||||
# Split the blocks at 8 colors
|
# Split the blocks at 8 colors
|
||||||
[ $end -ge 9 ] && [ $start -eq 8 ] && \
|
[ $end -ge 9 ] && [ $start -eq 8 ] && \
|
||||||
printf "\n%s" "${clear}${padding}"
|
printf "\n%s${clear}${padding}"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Clear formatting
|
# Clear formatting
|
||||||
printf "%s" "$clear"
|
printf "$clear"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,11 +523,11 @@ getimage () {
|
||||||
case "$image_position" in
|
case "$image_position" in
|
||||||
"left")
|
"left")
|
||||||
# Padding is half the terminal width + gap
|
# Padding is half the terminal width + gap
|
||||||
padding="$(tput cuf $((columns / split_size + gap)))"
|
padding="\e[$((columns / split_size + gap))C"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"right")
|
"right")
|
||||||
padding=$(tput cuf 0)
|
padding="\e[0C"
|
||||||
xoffset=$((columns * font_width / split_size - gap))
|
xoffset=$((columns * font_width / split_size - gap))
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -611,27 +611,27 @@ getimage () {
|
||||||
|
|
||||||
|
|
||||||
underline () {
|
underline () {
|
||||||
uline=$(printf %"$length"s)
|
underline=$(printf %"$length"s)
|
||||||
uline=${uline// /$underline_char}
|
underline=${underline// /$underline_char}
|
||||||
}
|
}
|
||||||
|
|
||||||
colors () {
|
colors () {
|
||||||
title_color="$(tput setaf $title_color)"
|
title_color="\e[38;5;${title_color}m"
|
||||||
subtitle_color="$(tput setaf $subtitle_color)"
|
subtitle_color="\e[38;5;${subtitle_color}m"
|
||||||
colon_color="$(tput setaf $colon_color)"
|
colon_color="\e[38;5;${colon_color}m"
|
||||||
underline_color="$(tput setaf $underline_color)"
|
underline_color="\e[38;5;${underline_color}m"
|
||||||
info_color="$(tput setaf $info_color)"
|
info_color="\e[38;5;${info_color}m"
|
||||||
}
|
}
|
||||||
|
|
||||||
bold () {
|
bold () {
|
||||||
if [ "$bold" == "on" ]; then
|
if [ "$bold" == "on" ]; then
|
||||||
bold="$(tput bold)"
|
bold="\e[1m"
|
||||||
else
|
else
|
||||||
bold=""
|
bold=""
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
clear="$(tput sgr0)"
|
clear="\e[0m"
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -818,7 +818,7 @@ printinfo () {
|
||||||
underline)
|
underline)
|
||||||
if [ "$underline" == "on" ]; then
|
if [ "$underline" == "on" ]; then
|
||||||
underline
|
underline
|
||||||
string="${underline_color}${uline}"
|
string="${underline_color}${underline}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -848,7 +848,7 @@ printinfo () {
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "%s\n" "${padding}${string}${clear}"
|
printf "%b%s\n" "${padding}${string}${clear}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,7 +863,7 @@ printinfo () {
|
||||||
[ "$images" == "on" ] && getimage
|
[ "$images" == "on" ] && getimage
|
||||||
|
|
||||||
# Hide the terminal cursor
|
# Hide the terminal cursor
|
||||||
tput civis
|
printf "\e[?25l"
|
||||||
|
|
||||||
# Clear the terminal
|
# Clear the terminal
|
||||||
clear
|
clear
|
||||||
|
@ -884,7 +884,7 @@ printinfo
|
||||||
[ $line_wrap == "off" ] && printf '\e[?7h'
|
[ $line_wrap == "off" ] && printf '\e[?7h'
|
||||||
|
|
||||||
# Move cursor to bottom and redisplay it.
|
# Move cursor to bottom and redisplay it.
|
||||||
printf "cup $(tput lines) \n cuu1 \n cnorm" | tput -S
|
printf "\e[$(tput lines)H\e[1A\e[?25h"
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
Reference in New Issue