bottom/docs/content/usage/widgets/battery.md
Rareș Constantin f8db3403af
other: Dynamic battery widget (#975)
* Added dynamic battery widget

For bottom to know that there are no batteries on the system,
I added the battery::Manager to the options.rs file because
here is the first moment bottom verifies battery configuration
by reading the config file, which may or may not contain the
battery field, but for a better UX, it doesn't matter what bottom
finds in the config file now, if it doesn't retrieve battery data,
it just ignores the battery widget all together.
If needed, it can be adjusted so that if the config file contains
the battery field, it will still show the widget.

* CFG guarding for BATTERY module

I guarded the options.rs in two places for battery module that can be missing in the feature list.

Co-authored-by: RaresCon <RaresCon>
Co-authored-by: NitrogenDev <44950964+NitrogenDev@users.noreply.github.com>
2023-01-15 12:06:42 -05:00

1.4 KiB

Battery Widget

!!! Warning

The battery features are unavailable if the binary is compiled with the `battery` feature disabled or if there are no batteries on the system!

The battery widget provides information about batteries on the system.

A picture of an expanded battery widget.

The battery widget can be enabled through either the --battery flag, the battery = true option in a config file, or specifying the widget in a custom layout.

Features

The following data is displayed for batteries:

  • Charge percent
  • Consumption
  • Time to empty/charge, based on the current state
  • Battery health percent

The battery widget also supports devices with multiple batteries, and you can switch between them using the keyboard or the mouse.

Key bindings

Note that key bindings are generally case-sensitive.

Binding Action
++left++
++h++
++alt+h++
Moves to the battery entry to the left of the current one
++right++
++l++
++alt+l++
Moves to the battery entry to the right of the current one

Mouse bindings

Binding Action
++lbutton++ Selects a battery entry