Merge pull request #2539 from chriswiggins/master

Update battery plugin to show calculating - OSX
This commit is contained in:
Robby Russell 2014-03-16 18:49:07 -07:00
commit 12415a99d2

View file

@ -34,7 +34,11 @@ if [[ $(uname) == "Darwin" ]] ; then
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
if [ $timeremaining -gt 720 ] ; then
echo "::"
else
echo "~$((timeremaining / 60)):$((timeremaining % 60))" echo "~$((timeremaining / 60)):$((timeremaining % 60))"
fi
else else
echo "∞" echo "∞"
fi fi