mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-11-05 22:21:48 +08:00
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
Battery Plugin
This plugin adds some functions you can use to display battery information in your custom theme.
To use, add battery to the list of plugins in your .zshrc file:
plugins=(... battery)
Then, add the battery_pct_prompt function to your custom theme. For example:
RPROMPT='$(battery_pct_prompt)'