Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
15a03744
Commit
15a03744
authored
Oct 17, 2019
by
GregoireW
Committed by
Marc Cornellà
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove invalid batteries (#8275)
parent
b8b87629
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
battery.plugin.zsh
plugins/battery/battery.plugin.zsh
+3
-3
No files found.
plugins/battery/battery.plugin.zsh
View file @
15a03744
...
@@ -112,12 +112,12 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
...
@@ -112,12 +112,12 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
elif
[[
"
$OSTYPE
"
=
linux
*
]]
;
then
elif
[[
"
$OSTYPE
"
=
linux
*
]]
;
then
function
battery_is_charging
()
{
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
()
{
function
battery_pct
()
{
if
((
$+
commands[acpi]
))
;
then
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
fi
}
}
...
@@ -131,7 +131,7 @@ elif [[ "$OSTYPE" = linux* ]]; then
...
@@ -131,7 +131,7 @@ elif [[ "$OSTYPE" = linux* ]]; then
function
battery_time_remaining
()
{
function
battery_time_remaining
()
{
if
!
battery_is_charging
;
then
if
!
battery_is_charging
;
then
acpi 2>/dev/null |
cut
-f3
-d
','
acpi 2>/dev/null |
c
ommand grep
-v
"rate information unavailable"
|
c
ut
-f3
-d
','
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