Haiku: Added battery support

This commit is contained in:
Dylan Araps 2016-11-05 08:46:29 +11:00
parent 342942e727
commit 68a14e5b1f

View file

@ -310,6 +310,7 @@ getuptime() {
uptime="$(uptime -u)"
uptime="${uptime/up }"
;;
*)
# Get uptime in seconds
case "$os" in
@ -1735,6 +1736,12 @@ getbattery() {
[ "$battery" ] && \
battery+="%"
;;
"Haiku")
battery0full="$(awk -F '[^0-9]*' 'NR==2 {print $4}' /dev/power/acpi_battery/0)"
battery0now="$(awk -F '[^0-9]*' 'NR==5 {print $4}' /dev/power/acpi_battery/0)"
battery="$((battery0full / battery0now * 100))%"
;;
esac
case "$battery_state" in