Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
ae1973de
Commit
ae1973de
authored
Apr 29, 2013
by
Ron Shapiro
Browse files
plugged_in function
parent
bc385531
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/battery/battery.plugin.zsh
View file @
ae1973de
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment