Fix prin usage within the script

This commit is contained in:
Dylan 2016-04-02 11:44:08 +11:00
parent 4ff462aae5
commit caf507e8b6

View file

@ -1060,17 +1060,17 @@ getcpu () {
cpu=${cpu//+( )/ }
# Add CPU info bar
prin "${subtitle}: ${cpu}"
prin "$subtitle" "$cpu"
if [ "$cpu_display" != "off" ]; then
cpu_usage="$(ps aux | awk 'BEGIN { sum = 0 } { sum += $3 }; END { print sum }')"
cpu_usage="${cpu_usage/\.*}%"
case "$cpu_display" in
"info") prin "${subtitle} Usage: ${cpu_usage}" ;;
"bar") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;;
"infobar") prin "${subtitle} Usage: ${cpu_usage} $(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;;
"barinfo") prin "${subtitle} Usage: $(bar "${cpu_usage/'%'}" $(( 100 * cores ))) ${cpu_usage}" ;;
"info") prin "$subtitle Usage" "$cpu_usage" ;;
"bar") prin "$subtitle Usage" "$(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;;
"infobar") prin "$subtitle Usage" "${cpu_usage} $(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;;
"barinfo") prin "$subtitle Usage" "$(bar "${cpu_usage/'%'}" $(( 100 * cores ))) $cpu_usage" ;;
esac
fi
[ "$stdout_mode" != "on" ] && unset cpu
@ -1336,10 +1336,10 @@ getsong () {
song=${song/$artist - }
if [ "$song" != "$artist" ]; then
prin "Artist: ${artist}"
prin "Song: ${song}"
prin "Artist" "$artist"
prin "Song" "$song"
else
prin "${subtitle}: ${song}"
prin "$subtitle" "$song"
fi
unset song
fi
@ -1650,10 +1650,10 @@ getbattery () {
index=0
for bat in "${batteries[@]}"; do
case "$battery_display" in
"bar") prin "${title}${index}: $(bar ${bat/'%'} 100)" ;;
"infobar") prin "${title}${index}: ${bat}% $(bar "${bat/'%'}" 100)" ;;
"barinfo") prin "${title}${index}: $(bar "${bat/'%'}" 100) ${bat}%" ;;
*) prin "${title}${index}: ${bat}%" ;;
"bar") prin "${title}${index}" "$(bar ${bat/'%'} 100)" ;;
"infobar") prin "${title}${index}" "${bat}% $(bar "${bat/'%'}" 100)" ;;
"barinfo") prin "${title}${index}" "$(bar "${bat/'%'}" 100) ${bat}%" ;;
*) prin "${title}${index}" "${bat}%" ;;
esac
index=$((index + 1))
done