Battery support for OpenBSD
This commit is contained in:
parent
105c7e06b7
commit
845a76504b
1 changed files with 9 additions and 1 deletions
10
fetch
10
fetch
|
@ -1397,11 +1397,19 @@ 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
|
||||
;;
|
||||
|
||||
|
|
Loading…
Reference in a new issue