Commit e8b85f92 authored by Robby Russell's avatar Robby Russell
Browse files

Merge pull request #1776 from ronshapiro/master

plugged_in function
parents a5df4d79 ae1973de
...@@ -18,11 +18,15 @@ if [[ $(uname) == "Darwin" ]] ; then ...@@ -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
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment