Changing to output 100% for full battery on OS X.
This commit ensures that `battery_percentage` has the same output on both Linux and OS X. Thanks @jfmcarreira for finding this!
This commit is contained in:
@@ -52,7 +52,7 @@ battery_percentage(){
|
||||
local IOREG_OUTPUT=$(ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%05.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}')
|
||||
case $IOREG_OUTPUT in
|
||||
100*)
|
||||
echo '99'
|
||||
echo '100'
|
||||
;;
|
||||
*)
|
||||
echo $IOREG_OUTPUT | head -c 2
|
||||
|
||||
Reference in New Issue
Block a user