commit
e8b85f9202
@ -18,11 +18,15 @@ if [[ $(uname) == "Darwin" ]] ; then
|
|||||||
echo $i
|
echo $i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function plugged_in() {
|
||||||
|
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
function battery_pct_remaining() {
|
function battery_pct_remaining() {
|
||||||
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
if plugged_in ; then
|
||||||
battery_pct
|
|
||||||
else
|
|
||||||
echo "External Power"
|
echo "External Power"
|
||||||
|
else
|
||||||
|
battery_pct
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user