Faster math syntax for index variables

This commit is contained in:
Dylan 2016-05-15 09:03:58 +10:00
parent c26f21ba76
commit 3293714633

View file

@ -1815,15 +1815,14 @@ getbattery () {
unset battery unset battery
# Print each battery on a separate line. # Print each battery on a separate line.
index=0
for bat in "${batteries[@]}"; do for bat in "${batteries[@]}"; do
case "$battery_display" in case "$battery_display" in
"bar") prin "${title}${index}" "$(bar ${bat/'%'} 100)" ;; "bar") prin "${title}${index:-0}" "$(bar ${bat/'%'} 100)" ;;
"infobar") prin "${title}${index}" "${bat}% $(bar "${bat/'%'}" 100)" ;; "infobar") prin "${title}${index:-0}" "${bat}% $(bar "${bat/'%'}" 100)" ;;
"barinfo") prin "${title}${index}" "$(bar "${bat/'%'}" 100) ${bat}%" ;; "barinfo") prin "${title}${index:-0}" "$(bar "${bat/'%'}" 100) ${bat}%" ;;
*) prin "${title}${index}" "${bat}%" ;; *) prin "${title}${index:-0}" "${bat}%" ;;
esac esac
index=$((index + 1)) index=$((index+=1))
done done
return return
fi fi
@ -2007,7 +2006,7 @@ getcols () {
7) printf "\033[4${start}m%${block_width}s${clear}\n${padding}" ;; 7) printf "\033[4${start}m%${block_width}s${clear}\n${padding}" ;;
*) printf "\033[48;5;${start}m%${block_width}s" ;; *) printf "\033[48;5;${start}m%${block_width}s" ;;
esac esac
start=$((start + 1)) start=$((start+=1))
done done
# Clear formatting # Clear formatting