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