1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-25 15:20:08 +00:00

plugged_in function

This commit is contained in:
Ron Shapiro 2013-04-29 10:18:32 -04:00
parent bc385531b0
commit ae1973de44

View file

@ -17,11 +17,15 @@ if [[ $(uname) == "Darwin" ]] ; then
echo $i
}
function plugged_in() {
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
}
function battery_pct_remaining() {
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
battery_pct
else
if plugged_in ; then
echo "External Power"
else
battery_pct
fi
}