mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
Merge pull request #2539 from chriswiggins/master
Update battery plugin to show calculating - OSX
This commit is contained in:
commit
12415a99d2
1 changed files with 5 additions and 1 deletions
|
@ -34,7 +34,11 @@ if [[ $(uname) == "Darwin" ]] ; then
|
|||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
||||
timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
||||
if [ $timeremaining -gt 720 ] ; then
|
||||
echo "::"
|
||||
else
|
||||
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
||||
fi
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue