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!pull/692/head
parent
18beb7f5d3
commit
c5de52aef3
|
|
@ -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: "?")}')
|
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
|
case $IOREG_OUTPUT in
|
||||||
100*)
|
100*)
|
||||||
echo '99'
|
echo '100'
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $IOREG_OUTPUT | head -c 2
|
echo $IOREG_OUTPUT | head -c 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue