Commit graph

33 commits

Author SHA1 Message Date
aimuz
5d8e1f8267
fix(battery): use pmset for battery percentage in macOS (#9364)
Returns the battery charge consistent with the system battery manager
2020-11-10 17:14:30 +01:00
Samuel Terra
a3740c3414
battery: add acpi requirement to README (#9116)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-07-18 18:45:59 +02:00
Marc Cornellà
d6474237b8 battery: revert battery charging symbol 1-character-width hack
Fixes #8804
2020-04-05 21:59:24 +02:00
Marc Cornellà
2a081d6e5e battery: remove printf usage where possible
Spares us of the need to quote % symbols
2020-03-30 18:49:01 +02:00
Marc Cornellà
3da469be5c battery: fix Full battery bug on Linux; force 1-char-width on charging symbol 2020-03-30 18:38:53 +02:00
Marc Cornellà
3e9e385d98 battery: remove redundant grep calls in battery_pct function 2020-02-25 15:41:17 +01:00
Marc Cornellà
7290a08bf6 battery: fix floating point output in macOS
Fixes #8676
2020-02-25 11:56:26 +01:00
GregoireW
15a03744a9 Remove invalid batteries (#8275) 2020-02-12 16:02:22 +01:00
Bruce Weirdan
b8b8762915 Report only active battery (#4726)
On a system with multiple batteries (like thinkpads) report percentage
and time remaining only for the active battery (the one being
discharged).

Ideally we should report all batteries, but acpi only shows time remaining
for the active battery. Also callers of these functions expect a single
return value. This is still better than reporting 596% remaining (like it
did on my laptop).

For the reference, the output of acpi command with multiple batteries looks
like this:

    Battery 0: Unknown, 5%
    Battery 1: Discharging, 86%, 03:14:04 remaining
2020-02-12 15:29:57 +01:00
Marc Cornellà
5f6f7b6e8d Various syntax fixes and function naming equivalence
- Fix code style
- Fix local definitions
- Don't declare unnecessary variables
- Use `command` before grep
2020-02-11 21:25:38 +01:00
Marc Cornellà
39e61614f2 Clean up Linux battery commands and syntax 2020-02-11 21:25:38 +01:00
Marc Cornellà
1bd7a7ad21 Fix calculation for battery percentage (#4774)
Co-authored-by: Michael Wolman <michael.s.wolman@gmail.com>
2020-02-11 21:25:38 +01:00
927589452
49c423c7e0 battery: add support for sysctl in FreeBSD (#8155) 2019-10-09 19:24:44 +02:00
John Oerter
3a8b93727f battery: add README (#7309) 2018-10-18 20:58:14 +02:00
guyzmo
8611aa8049 Fixing battery prompt formatting issue (cf #5894) (#5895)
Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
2017-02-22 23:50:49 -08:00
Hong
a56eac7a71 Use OSTYPE instead of uname whenever possible for better speed. (#5496) 2016-10-10 22:24:30 +02:00
Reed Riley
59c66dbfc2 Fix battery plugin when acpi writes to stderr (#5413)
* Fix battery plugin when acpi writes to stderr
* Make stderr redirection in battery plugin more idiomatic
2016-09-15 02:01:10 +02:00
Christian Höltje
63bae2aba9 Use $OSTYPE instead of uname to speed things up
The $OSTYPE variable is set at ZSH compile time and can be safely used
to determine the OS of the system. e.g. darwin (os x)
2014-07-23 09:18:14 -04:00
Reed Riley
fb2d6eb567 Fixed errors if acpitool isn't installed on linux 2014-03-18 14:13:54 -04:00
Robby Russell
12415a99d2 Merge pull request #2539 from chriswiggins/master
Update battery plugin to show calculating - OSX
2014-03-16 18:49:07 -07:00
Robby Russell
23a43e9fd6 Merge pull request #2574 from thiagowfx/linux-battery
added the linux implementation to the battery plugin
2014-03-16 18:46:50 -07:00
Robby Russell
e8b85f9202 Merge pull request #1776 from ronshapiro/master
plugged_in function
2014-03-13 07:41:18 -07:00
Thiago Perrotta
564a708d6a added the linux implementation to the battery plugin 2014-03-02 14:47:43 -03:00
Chris Wiggins
fdd864bd5b Update battery plugin to show calculating - OSX
Instantly after removing the charger, I have found that the "AvgTimeToEmpty" value can swing to rediculous values. Apple's current claim is that the max battery life is 12 hours, so any value larger than this is considered a "time is being calculated" value.
2014-02-17 13:32:24 +13:00
Brice Dutheil
cc8b09366b Adds a method that print a battery gauge
It is especially useful for themes, this function is a port of the code written by Steve Losh
and made available on [this blog entry](http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity)
2014-01-18 13:58:42 +01:00
James Seward
8cfc7d6677 Prevent errors in prompts if no info available.
Define empty functions instead of none at all if we can't figure out the
platform.
2013-11-04 21:00:11 -05:00
Ron Shapiro
ae1973de44 plugged_in function 2013-04-29 10:18:32 -04:00
Robby Russell
7787d1da6e Merge pull request #1641 from NeuralSandwich/master
Battery plugin updates
2013-04-23 20:01:40 -07:00
Ron Shapiro
bc385531b0 Separate the battery_pct_remaining data into it's own function so that it can be obtained even if the battery is connected. 2013-04-20 22:37:36 -04:00
Sean Jones
fdd46d8815 Updated battery plugin. Displays charging time.
linux battery level now refreshes after every command
2013-03-02 11:09:57 +00:00
Sean Jones
5991bf3ac1 Fixed Kernel Detection in battery plugin 2012-12-02 20:39:01 +00:00
Sean Jones
e226fc048a Added support for Mac to battery plugin 2012-12-02 19:36:33 +00:00
Peter Hoeg
6095fe4f71 add: battery plugin 2011-10-20 14:12:13 +08:00