OpenBSD is a pretty strange OS

This commit is contained in:
Tudor 2016-02-23 11:24:38 +02:00
parent 845a76504b
commit cfa2df540c
1 changed files with 11 additions and 9 deletions

20
fetch
View File

@ -1397,22 +1397,24 @@ getbattery () {
fi
;;
*"BSD")
"BSD")
case "$distro" in
"FreeBSD"*)
battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}')
;;
"OpenBSD")
battery0full=$(sysctl -n hw.sensors.acpibat0.watthour0)
battery0full=${battery0full/ Wh*}
battery0now=$(sysctl -n hw.sensors.acpibat0.watthour3)
battery0now="${battery0now/ Wh*}"
battery="$(( 100 * $battery0now / $battery0full ))%"
esac
;;
"OpenBSD")
battery0full=$(sysctl -n hw.sensors.acpibat0.watthour0)
battery0full=${battery0full/ Wh*}
battery0now=$(sysctl -n hw.sensors.acpibat0.watthour3)
battery0now="${battery0now/ Wh*}"
battery="$(( 100 * $battery0now / $battery0full ))%"
;;
"Mac OS X")
battery="$(pmset -g batt | grep -o '[0-9]*%')"
;;