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
Oh My Zsh
Commits
15a03744
Commit
15a03744
authored
Oct 17, 2019
by
GregoireW
Committed by
Marc Cornellà
Feb 12, 2020
Browse files
Remove invalid batteries (#8275)
parent
b8b87629
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/battery/battery.plugin.zsh
View file @
15a03744
...
...
@@ -112,12 +112,12 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
elif
[[
"
$OSTYPE
"
=
linux
*
]]
;
then
function
battery_is_charging
()
{
!
acpi 2>/dev/null |
command grep
-q
'^Battery.*Discharging'
!
acpi 2>/dev/null |
command grep
-v
"rate information unavailable"
|
command grep
-q
'^Battery.*Discharging'
}
function
battery_pct
()
{
if
((
$+
commands[acpi]
))
;
then
acpi 2>/dev/null |
command grep
-E
'^Battery.*(Disc|C)harging'
|
cut
-f2
-d
','
|
tr
-cd
'[:digit:]'
acpi 2>/dev/null |
command grep
-v
"rate information unavailable"
|
command grep
-E
'^Battery.*(Disc|C)harging'
|
cut
-f2
-d
','
|
tr
-cd
'[:digit:]'
fi
}
...
...
@@ -131,7 +131,7 @@ elif [[ "$OSTYPE" = linux* ]]; then
function
battery_time_remaining
()
{
if
!
battery_is_charging
;
then
acpi 2>/dev/null |
cut
-f3
-d
','
acpi 2>/dev/null |
command grep
-v
"rate information unavailable"
|
cut
-f3
-d
','
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