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
12415a99
Commit
12415a99
authored
Mar 16, 2014
by
Robby Russell
Browse files
Merge pull request #2539 from chriswiggins/master
Update battery plugin to show calculating - OSX
parents
dcae31d0
fdd864bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/battery/battery.plugin.zsh
View file @
12415a99
...
@@ -34,7 +34,11 @@ if [[ $(uname) == "Darwin" ]] ; then
...
@@ -34,7 +34,11 @@ if [[ $(uname) == "Darwin" ]] ; then
local
smart_battery_status
=
"
$(
ioreg
-rc
"AppleSmartBattery"
)
"
local
smart_battery_status
=
"
$(
ioreg
-rc
"AppleSmartBattery"
)
"
if
[[
$(
echo
$smart_battery_status
|
grep
-c
'^.*"ExternalConnected"\ =\ No'
)
-eq
1
]]
;
then
if
[[
$(
echo
$smart_battery_status
|
grep
-c
'^.*"ExternalConnected"\ =\ No'
)
-eq
1
]]
;
then
timeremaining
=
$(
echo
$smart_battery_status
|
grep
'^.*"AvgTimeToEmpty"\ =\ '
|
sed
-e
's/^.*"AvgTimeToEmpty"\ =\ //'
)
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
else
echo
"∞"
echo
"∞"
fi
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