cosmetical changes according to @dylanaraps suggestions

This commit is contained in:
dawidd6 2016-03-25 13:50:49 +01:00
parent faefa6c0fe
commit 2c7696fdd0
1 changed files with 16 additions and 15 deletions

View File

@ -1551,8 +1551,8 @@ getbattery () {
# Create an array of battery usage from each battery. # Create an array of battery usage from each battery.
batteries=($(cat /sys/class/power_supply/BAT${battery_num}/capacity)) batteries=($(cat /sys/class/power_supply/BAT${battery_num}/capacity))
# Get the power status # Get the power status
power_status=($(cat /sys/class/power_supply/BAT${battery_num}/status)) battery_status=($(cat /sys/class/power_supply/BAT${battery_num}/status))
# Get the subtitle and reassign it so it doesn't change. # Get the subtitle and reassign it so it doesn't change.
title="$subtitle" title="$subtitle"
@ -1579,11 +1579,12 @@ getbattery () {
done done
return return
fi fi
if [ $power_status = "Charging" ]; then
battery="${batteries[0]}% Charging" if [ "$battery_status" == "Charging" ]; then
else battery="${batteries[0]}% Charging"
battery="${batteries[0]}%" else
fi battery="${batteries[0]}%"
fi
fi fi
else else
battery="None" battery="None"
@ -1593,12 +1594,12 @@ getbattery () {
"BSD") "BSD")
case "$distro" in case "$distro" in
"FreeBSD"*) "FreeBSD"*)
power_status=$(acpiconf -i 0 | awk -F ':\t\t\t' '/State/ {print $2}') battery_status=$(acpiconf -i 0 | awk -F ':\t\t\t' '/State/ {print $2}')
if [ $power_status = "charging" ]; then if [ "$battery_status" == "charging" ]; then
battery="$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}') Charging" battery="$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}') Charging"
else else
battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}') battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}')
fi fi
;; ;;
@ -1621,8 +1622,8 @@ getbattery () {
"Mac OS X") "Mac OS X")
battery="$(pmset -g batt | grep -o '[0-9]*%')" battery="$(pmset -g batt | grep -o '[0-9]*%')"
power_status="$(pmset -g batt | awk 'NR==2 {print $3}')" battery_status="$(pmset -g batt | awk 'NR==2 {print $3}')"
[ "$power_status" == "charging;" ] && \ [ "$battery_status" == "charging;" ] && \
battery="${battery} Charging" battery="${battery} Charging"
;; ;;