fixed battery_status to show only charging status + added battery_status to FreeBSD

This commit is contained in:
dawidd6 2016-03-20 15:06:28 +01:00
parent 85a0e2cc80
commit 5bcaa342a8

View file

@ -1573,14 +1573,17 @@ getbattery () {
"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
return return
fi fi
if [ $power_status = "Charging" ]; then
battery="${batteries[0]}% ${power_status}" battery="${batteries[0]}% ${power_status}"
else
battery="${batteries[0]}%"
fi
fi fi
else else
battery="None" battery="None"
@ -1590,7 +1593,13 @@ getbattery () {
"BSD") "BSD")
case "$distro" in case "$distro" in
"FreeBSD"*) "FreeBSD"*)
power_status=$(acpiconf -i 0 | awk -F ':\t\t\t' '/State/ {print $2}')
if [ $power_status = "charging" ]; then
battery="$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}') $power_status"
else
battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}') battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}')
fi
;; ;;
"NetBSD"*) "NetBSD"*)