Merge pull request #328 from konimex/master

OpenBSD's battery status get back into the BSD case
This commit is contained in:
Dylan Araps 2016-09-03 02:16:32 +10:00 committed by GitHub
commit 9a5d4ad07c

View file

@ -1670,10 +1670,8 @@ getbattery() {
battery="$(envstat | awk '\\(|\\)' '/charge:/ {print $2}')" battery="$(envstat | awk '\\(|\\)' '/charge:/ {print $2}')"
battery="${battery/\.*/%}" battery="${battery/\.*/%}"
;; ;;
esac
;;
"OpenBSD") "OpenBSD"*)
battery0full="$(sysctl -n hw.sensors.acpibat0.watthour0)" battery0full="$(sysctl -n hw.sensors.acpibat0.watthour0)"
battery0full="${battery0full/ Wh*}" battery0full="${battery0full/ Wh*}"
@ -1683,6 +1681,8 @@ getbattery() {
[ "$battery0full" ] && \ [ "$battery0full" ] && \
battery="$((100 * ${battery0now/\.} / ${battery0full/\.}))%" battery="$((100 * ${battery0now/\.} / ${battery0full/\.}))%"
;; ;;
esac
;;
"Mac OS X") "Mac OS X")
battery="$(pmset -g batt | grep -o '[0-9]*%')" battery="$(pmset -g batt | grep -o '[0-9]*%')"