Commit graph

101 commits

Author SHA1 Message Date
wzy 91b05110cc
Fix termux (#114) 2025-06-10 14:14:31 +02:00
Tomasz Kania-Orzeł 48fae59ba4
fix(battery-remain): fix with acpi and @batt_remain_short option (#112) 2023-12-01 09:37:22 +01:00
Jediah Katz 5c52d4f7f8
Add support for WSL2 and for alternate powersupply names (#100) 2021-01-02 17:38:28 +01:00
Abhijeet Viswam f865b04f78
Added support for WSL (#95) 2020-12-29 20:48:32 +01:00
Dan Cassidy f8b8e84519 Readme variable fix (#85)
* Fixed variable names inside README file

* More fixed variables.

* Updated some verbiage

This should help to make some of the descriptions more clear.
2019-07-04 12:42:38 +02:00
Dan Cassidy 86952b21cf Fixed variable names inside README file (#84) 2019-07-03 10:27:19 +02:00
tsutomu 0272f2fc94 Modified not to print under the decimal points. (#83) 2019-06-16 12:15:46 +02:00
Dan Cassidy 8f1626fe95 Color icon upgrade (#80)
* Upgrade color and icons to have higher granularity

This is a large overhaul of the colors and icons in the plugin to enable
higher granularity. All efforts have been made to have sane defaults.

Additionally, a new 'status' has been added that is a catch-all
'unknown' in case a battery tool acts up or fails to report something
meaningful.

Added 8 new format strings:
* #{battery_color_bg} - will set the background color of the status bar
  based on the battery charge level and status
* #{battery_color_fg} - will set the foreground color of the status bar
  based on the battery charge level and status
* #{battery_color_charge_bg} - will set the background color of the
  status bar based solely on the battery charge level
* #{battery_color_charge_fg} - will set the foreground color of the
  status bar based solely on the battery charge level
* #{battery_color_status_bg} - will set the background color of the
  status bar based solely on the battery status
* #{battery_color_status_fg} - will set the foreground color of the
  status bar based solely on the battery status
* #{battery_icon_charge} - will display a battery charge icon
* #{battery_icon_status} - will display a battery status icon

Removed 2 format strings:
* #{battery_status_bg}
* #{battery_status_fg}

Added 39 new options:
* @batt_color_charge_primary_tier8 - primary color to show at [95%-100%]
  battery charge
* @batt_color_charge_primary_tier7 - primary color to show at [80%-95%)
  battery charge
* @batt_color_charge_primary_tier6 - primary color to show at [65%-90%)
  battery charge
* @batt_color_charge_primary_tier5 - primary color to show at [50%-65%)
  battery charge
* @batt_color_charge_primary_tier4 - primary color to show at [35%-50%)
  battery charge
* @batt_color_charge_primary_tier3 - primary color to show at [20%-35%)
  battery charge
* @batt_color_charge_primary_tier2 - primary color to show at [5%-20%)
  battery charge
* @batt_color_charge_primary_tier1 - primary color to show at [0%-5%)
  battery charge
* @batt_color_charge_secondary_tier8 - secondary color to show at [95%-
  100%] battery charge
* @batt_color_charge_secondary_tier7 - secondary color to show at [80%-
  95%) battery charge
* @batt_color_charge_secondary_tier6 - secondary color to show at [65%-
  90%) battery charge
* @batt_color_charge_secondary_tier5 - secondary color to show at [50%-
  65%) battery charge
* @batt_color_charge_secondary_tier4 - secondary color to show at [35%-
  50%) battery charge
* @batt_color_charge_secondary_tier3 - secondary color to show at [20%-
  35%) battery charge
* @batt_color_charge_secondary_tier2 - secondary color to show at [5%-
  20%) battery charge
* @batt_color_charge_secondary_tier1 - secondary color to show at [0%-
  5%) battery charge
* @batt_color_status_primary_charged - primary color to show for a
  battery in 'fully-charged' status
* @batt_color_status_primary_charging - primary color to show for a
  battery in 'charging' status
* @batt_color_status_primary_discharging - primary color to show for a
  battery in 'discharging' status
* @batt_color_status_primary_attached - primary color to show for a
  battery in 'attached' status
* @batt_color_status_primary_unknown - primary color to show for a
  battery in an unknown status
* @batt_color_status_secondary_charged - secondary color to show for a
  battery in 'fully-charged' status
* @batt_color_status_secondary_charging - secondary color to show for a
  battery in 'charging' status
* @batt_color_status_secondary_discharging - secondary color to show for
  a battery in 'discharging' status
* @batt_color_status_secondary_attached - secondary color to show for a
  battery in 'attached' status
* @batt_color_status_secondary_unknown - secondary color to show for a
  battery in an unknown status
* @batt_icon_charge_tier8 - icon to show at [95%-100%] battery charge
* @batt_icon_charge_tier7 - icon to show at [80%-95%) battery charge
* @batt_icon_charge_tier6 - icon to show at [65%-90%) battery charge
* @batt_icon_charge_tier5 - icon to show at [50%-65%) battery charge
* @batt_icon_charge_tier4 - icon to show at [35%-50%) battery charge
* @batt_icon_charge_tier3 - icon to show at [20%-35%) battery charge
* @batt_icon_charge_tier2 - icon to show at [5%-20%) battery charge
* @batt_icon_charge_tier1 - icon to show at [0%-5%) battery charge
* @batt_icon_status_charged - icon to show for a battery in 'fully-
  charged' status
* @batt_icon_status_charging - icon to show for a battery in 'charging'
  status
* @batt_icon_status_discharging - icon to show for a battery in
  'discharging' status
* @batt_icon_status_attached - icon to show for a battery in 'attached'
  status
* @batt_icon_status_unknown - icon to show for a battery in an unknown
  status

Removed 12 options:
* @batt_charged_icon
* @batt_charging_icon
* @batt_attached_icon
* @batt_full_charge_icon
* @batt_high_charge_icon
* @batt_medium_charge_icon
* @batt_low_charge_icon
* @batt_color_full_charge
* @batt_color_high_charge
* @batt_color_medium_charge
* @batt_color_low_charge
* @batt_color_charging

Format string notes:
* #{battery_color_bg} and #{battery_color_fg} replace
  #{battery_status_bg} and #{battery_status_fg}, respectively and
  continue to act the same way
* #{battery_color_charge_bg/fg} changes colors based ONLY on the battery
  charge level
* #{battery_color_status_bg/fg} changes colors based ONLY on the battery
  status
* #{battery_icon_charge} displays ONLY an icon for the charge level
* #{battery_icon_status} displays ONLY an icon for the charge status
* #{battery_icon} continues to display both

Option notes:
* @batt_color_..._primary options are what will be displayed in the main
  bg or fg you choose - e.g. if you use #{battery_color_bg}, the primary
  color will be the background
* Likewise, the corresponding @batt_color_..._secondary option will be
  the foreground in the example above

* Fixed #{battery_graph} format string

Previously, the #{battery_graph} format string wouldn't show an actual
graph. This has been fixed. The graph is also 5 characters wide now,
regardless of battery charge level.

* Clarified some language in README.md

* Changed a word because words are hard
2019-05-31 15:38:32 +02:00
Bruno Sutic 8e5f5ab4c6
Update README.md 2019-04-19 12:43:26 +02:00
Martin Beentjes ac1c768e07
Update README.md 2019-04-13 14:00:31 +02:00
Dan Cassidy d163ef37a6 Changed acpi to be preferred over upower (#78) 2019-03-27 21:29:14 +01:00
Franz Bettag 588a941cde adds support for OpenBSD apm. (#77) 2019-03-11 11:05:40 +01:00
Malcolm Scott cc18faec34 If upower reports a percentage, just use that (#76)
I have a device (Gemini PDA) whose energy and energy-full are both zero, but the percentage is correct so just use that.  Upower probably knows best.  Probably also fixes #65.
2019-03-11 10:53:25 +01:00
Diego Ximenes c60c41c826 Fix batt_remain_short behavior when using upower. (#73) 2019-01-14 11:28:20 +01:00
Yigong Wang 5a3d235119 Fix the "charged" icon for some environments (#72) 2018-12-09 12:56:22 +01:00
Yishen Miao 8cb3cce426 Adding status_bg for charging (#71)
a follow-up to  #68. The background color is added for charging status.
2018-11-26 14:31:34 +01:00
hulkk c2cd5c8687 fix time to charge display on mac, closes #28 (#68)
* fix time to charge display on mac, closes #28
* add charging colour to battery_status_fg
* fix incorrect colours when discharging
* change charging colour default to green
* add text to show charged when applicable instead of 0:00
2018-08-03 10:03:23 +02:00
Johannes Wikner 8d5adf92fd Use DisplayDevice if available (#67)
For laptops with multiple batteries, DisplayDevice should be
  available, otherwise stick to the old behaviour.

  See https://upower.freedesktop.org/docs/UPower.html#id-1.2.3.8.5
2018-07-25 21:36:53 +02:00
Martin Beentjes db0698ea86
Update README.md 2018-06-12 15:27:53 +02:00
Igor de Alcantara Barroso 24f088fe5b Add dependencies to the readme (#66) 2018-06-12 15:23:10 +02:00
Aaron Zeng 09be78c35e Substitute all occurrences of variables (#63) (#64)
This commit addresses #63 by making sure all occurrences of each
variables in the status line are substituted.
2017-10-24 08:59:56 +02:00
Michael Foley b4cf61da23 Remove deprecated icon setting in README (#62)
`batt_discharging_icon` was removed in 215de6d
2017-10-10 09:32:07 +02:00
Thomas Gordon Lowrey IV 8da22116eb termux initial support (#61) 2017-10-01 18:12:26 +02:00
Cédric Michaux 267d960601 Allow to put colors in discharging icons (#60) 2017-09-29 08:43:27 +02:00
Dima 215de6dcd2 Use battery percentage icons (#59)
* Add dynamic battery level icons
* Update README to use correct battery icon variables
2017-09-23 23:23:12 +02:00
hanfried b630ec8707 Assume no battery percentage as ok, assume it might be a desktop (#58) 2017-08-28 14:10:44 +02:00
Philipp Schmitt 51499f1cc7 Fix multiple batteries on linux (#57) 2017-08-22 11:40:34 +02:00
Johan Bleuzen 7810c8d7ec Fix: Don't process empty batteries variable (#56) 2017-07-13 10:12:49 +02:00
Justin Campbell d64c7fecc8 Fix missing argument to awk (#53)
Fixes time remaining when short=true
2017-07-03 16:54:57 +02:00
Justin Campbell 3d7cfed467 Add @batt_remain_short variable (#52)
* Remove format string count
* Add variable @batt_remain_short

Hides output if battery is charging or charged, and shortens the discharging output to ~H:MM.
2017-06-26 16:54:27 +02:00
Camille TJHOA 8fa3b627b6 Fix typo (#51) 2017-05-08 10:46:59 +02:00
David Vass 9a4e6ef8e4 Show time to charge battery on Mac OS (#46)
* Show time to charge battery on Mac OS

* Rename  variable to
2017-04-20 22:59:10 +02:00
Martin Beentjes 49ff2993be Update README.md
Added Aleksandar Djurdjic to the list of contributors.
2017-01-30 21:14:48 +01:00
Martin Beentjes 06688f8a64 Update README.md
Added the foreground color option
2017-01-30 21:12:11 +01:00
Aleksandar Djurdjic c7034799bc Adapted script files to also print colored fg sequence (#47) 2017-01-30 21:11:00 +01:00
Martin Beentjes f121a2368c Update README.md 2017-01-28 12:32:47 +01:00
Martin Beentjes 0a2d6d02e4 Update README.md
Restructured the README page. The example pictures will be resized to a constant size.
2017-01-28 12:03:50 +01:00
Martin Beentjes a3a955e782 Update README.md
Added a list of the contributors to the README.md
2017-01-02 15:31:09 +01:00
Tom Levens 629902d532 Fix simplified interpolation in bash < 4.0 (#39)
Bash versions < 4.0 do not support associative arrays and MacOS Sierra
still ships with Bash 3.2. This splits the interpolation text and
command into two lists. While this is not as nice, it is supported by
any version of bash.
2016-10-21 11:59:39 +02:00
Tom Levens af7b4be994 Fixed graph when no battery available (#38) 2016-10-21 11:59:32 +02:00
Tom Levens af907c2ceb Added graph formatting option, simplify interpolation (#37)
* Added prefix/suffix scripts and graph using Spark
* Reformatted indents, updated README.md
* Updated variable names & docs
* Change to bash C-style for loop
* Fix spaces to tabs
* Fixed spaces to tabs in battery_graph.sh
* Added missing ""
2016-10-20 00:12:03 +02:00
Martin Beentjes 1df74d095d Update CHANGELOG.md 2016-10-05 11:29:55 +02:00
Joseph fe54f2eb66 Chromebook Support for battery stat (#22)
* chromebook check by /sys/class/chromeos/cros_ecs

By checking the existence of the file `/sys/class/chromeos/cros_ecs` (Chrome OS Embedded Controller), one can determine if the machine is a Chromebook. Every Chromebook using the armv7 and x86 architecture will have this file.
2016-10-05 11:29:04 +02:00
Martin Beentjes 926bfd51fd Update CHANGELOG.md 2016-10-02 17:13:11 +02:00
Evan N-D e70f252bda Fix multi-battery output with upower (#36)
Given multiple batteries in a machine, we will combine the energy and
energy-full values from each battery, then divide the total energy by
the total energy-full, and multiple by 100 to get a percentage. We use
awk to avoid introducing new dependencies, and to also handle the
floating point arithmetic and eventual truncation. This code will always
round your current percentage down.
2016-10-02 17:12:37 +02:00
Martin Beentjes 77760e09af Update README.md 2016-10-01 16:37:28 +02:00
Martin Beentjes 1f7686e0ae Update CHANGELOG.md 2016-10-01 16:14:38 +02:00
Ryan Frantz ce8d85440e Adds support for changing bg color based on battery percentage. (#29)
* Adds support for changing bg color based on battery percentage.

- If #{battery_status_bg} is used, the background of this plugin's status bar will be:
- 'green' for 100% charged
- 'yellow' for 99% to 51% charge
- orange ('colour208') for 50% to 16% charge
- 'red' for 15% to 0% charge

* Adds support for background colors set in user's tmux config.

- The background colors can be configured via 'batt_color_full_charge', 'batt_color_high_charge', 'batt_color_medium_charge', and 'batt_color_low_charge'.
- Sane defaults are provided as well.
2016-10-01 16:12:14 +02:00
Martin Beentjes ae8deefe57 Update README.md 2016-09-28 22:41:23 +02:00
Martin Beentjes d2e7f7bc28 Bump version in CHANGELOG.md 2016-09-24 23:58:16 +02:00