2019-08-24 17:44:29 +01:00
waybar-battery(5)
# NAME
waybar - battery module
# DESCRIPTION
The * battery * module displays the current capacity and state (eg. charging) of your battery.
2019-08-24 21:46:56 +01:00
# CONFIGURATION
2020-04-12 18:41:44 +02:00
* bat * : ++
2019-08-24 17:44:29 +01:00
typeof: string ++
The battery to monitor, as in /sys/class/power_supply/ instead of auto detect.
2020-04-12 18:41:44 +02:00
* adapter * : ++
2019-08-24 17:44:29 +01:00
typeof: string ++
The adapter to monitor, as in /sys/class/power_supply/ instead of auto detect.
2020-04-12 18:41:44 +02:00
* full-at * : ++
2020-04-05 16:56:51 +02:00
typeof: integer ++
2020-11-27 10:55:27 +00:00
Define the max percentage of the battery, for when you've set the battery to stop charging at a lower level to save it. For example, if you've set the battery to stop at 80% that will become the new 100%.
2020-04-05 16:56:51 +02:00
2021-01-03 15:25:19 +01:00
* design-capacity * : ++
2023-07-30 17:33:02 +02:00
typeof: bool ++
default: false ++
2023-10-21 21:15:25 +05:30
Option to use the battery design capacity instead of its current maximal capacity.
2021-01-03 15:25:19 +01:00
2020-04-12 18:41:44 +02:00
* interval * : ++
2019-08-24 17:44:29 +01:00
typeof: integer ++
default: 60 ++
The interval in which the information gets polled.
2020-04-12 18:41:44 +02:00
* states * : ++
2022-11-07 20:30:01 +13:00
typeof: object ++
2019-08-24 17:44:29 +01:00
A number of battery states which get activated on certain capacity levels. See *waybar-states(5)*.
2020-04-12 18:41:44 +02:00
* format * : ++
2019-08-24 17:44:29 +01:00
typeof: string ++
default: {capacity}% ++
2022-07-15 11:01:14 +03:00
The format, how information should be displayed.
2019-08-24 17:44:29 +01:00
2020-04-12 18:41:44 +02:00
* format-time * : ++
2019-09-06 14:53:43 -04:00
typeof: string ++
default: {H} h {M} min ++
The format, how the time should be displayed.
2020-01-04 04:31:24 +01:00
* format-icons * : ++
typeof: array/object ++
2019-08-24 17:44:29 +01:00
Based on the current capacity, the corresponding icon gets selected. ++
The order is *low* to *high*. Or by the state if it is an object.
2020-01-04 04:31:24 +01:00
* max-length * : ++
2019-08-24 17:44:29 +01:00
typeof: integer++
The maximum length in character the module should display.
2021-02-01 08:34:51 -08:00
* min-length * : ++
2023-07-30 17:33:02 +02:00
typeof: integer ++
2023-10-21 21:15:25 +05:30
The minimum length in characters the module should accept.
2021-02-01 08:34:51 -08:00
* align * : ++
2023-07-30 17:33:02 +02:00
typeof: float ++
2024-03-04 20:00:57 +01:00
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
* justify * : ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
2021-02-01 08:34:51 -08:00
2020-01-04 04:31:24 +01:00
* rotate * : ++
2019-08-24 17:44:29 +01:00
typeof: integer++
2024-09-08 13:33:52 +02:00
Positive value to rotate the text label (in 90 degree increments).
2019-08-24 17:44:29 +01:00
2020-01-04 04:31:24 +01:00
* on-click * : ++
2019-08-24 17:44:29 +01:00
typeof: string ++
Command to execute when clicked on the module.
2019-12-28 20:19:45 -08:00
* on-click-middle * : ++
typeof: string ++
Command to execute when middle-clicked on the module using mousewheel.
2020-04-12 18:35:41 +02:00
* on-click-right * : ++
2019-08-24 17:44:29 +01:00
typeof: string ++
2023-10-21 21:15:25 +05:30
Command to execute when you right-click on the module.
2019-08-24 17:44:29 +01:00
2020-04-12 18:35:41 +02:00
* on-update * : ++
typeof: string ++
Command to execute when the module is updated.
2020-01-04 04:31:24 +01:00
* on-scroll-up * : ++
2019-08-24 17:44:29 +01:00
typeof: string ++
Command to execute when scrolling up on the module.
2025-10-26 06:34:04 +01:00
* weighted-average * : ++
typeof: bool ++
default: false ++
Option to combine multiple batteries with different capacities.
2020-01-04 04:31:24 +01:00
* on-scroll-down * : ++
2019-08-24 17:44:29 +01:00
typeof: string ++
Command to execute when scrolling down on the module.
2020-04-12 18:41:44 +02:00
* smooth-scrolling-threshold * : ++
2019-08-24 17:44:29 +01:00
typeof: double ++
Threshold to be used when scrolling.
2020-04-12 18:41:44 +02:00
* tooltip * : ++
2019-08-24 17:44:29 +01:00
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
2023-09-12 13:39:09 -03:00
* bat-compatibility * : ++
typeof: bool ++
default: false ++
Option to enable battery compatibility if not detected.
2024-05-28 20:42:12 +02:00
* menu * : ++
typeof: string ++
Action that popups the menu.
* menu-file * : ++
typeof: string ++
Location of the menu descriptor file. There need to be an element of type
2025-06-22 12:45:28 +02:00
GtkMenu with id *menu*.
2024-05-28 20:42:12 +02:00
* menu-actions * : ++
typeof: array ++
The actions corresponding to the buttons of the menu.
2024-10-30 17:04:13 +01:00
* expand * : ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
2025-06-22 12:45:28 +02:00
* events * : ++
typeof: object ++
Specifies commands to be executed on specific battery states. See *EVENTS* section below.
2019-08-24 21:46:56 +01:00
# FORMAT REPLACEMENTS
2019-08-24 17:44:29 +01:00
* {capacity} * : Capacity in percentage
2021-01-24 21:49:00 +01:00
* {power} * : Power in watts
2019-08-24 17:44:29 +01:00
* {icon} * : Icon, as defined in * format-icons * .
* {time} * : Estimate of time until full or empty. Note that this is based on the power draw at the last refresh time, not an average.
2024-04-10 17:00:50 +02:00
* {cycles} * : Amount of charge cycles the highest-capacity battery has seen. * (Linux only) *
2024-04-10 18:19:55 +02:00
* {health} * : The percentage of the highest-capacity battery's original maximum charge it can still hold.
2019-09-06 14:53:43 -04:00
# TIME FORMAT
The * battery * module allows you to define how time should be formatted via * format-time * .
2022-01-29 11:29:57 -07:00
The three arguments are:
2019-09-06 14:53:43 -04:00
* {H} * : Hours
* {M} * : Minutes
2022-01-29 11:29:57 -07:00
* {m} * : Zero-padded minutes
2019-09-06 14:53:43 -04:00
2019-08-24 21:46:56 +01:00
# CUSTOM FORMATS
2019-08-24 17:44:29 +01:00
2023-10-21 21:15:25 +05:30
The * battery * module allows one to define custom formats based on up to two factors. The best-fitting format will be selected.
2019-08-24 17:44:29 +01:00
* format-<state> * : With * states * , a custom format can be set depending on the capacity of your battery.
* format-<status> * : With the status, a custom format can be set depending on the status in /sys/class/power_supply/<bat>/status (in lowercase).
* format-<status>-<state> * : You can also set a custom format depending on both values.
2019-08-24 21:46:56 +01:00
# STATES
2019-08-24 17:44:29 +01:00
- Every entry (* state * ) consists of a * <name> * (typeof: * string * ) and a * <value> * (typeof: * integer * ).
2023-10-21 21:15:25 +05:30
- The state can be addressed as a CSS class in the * style.css * . The name of the CSS class is the * <name> * of the state. Each class gets activated when the current capacity is equal to or below the configured * <value> * .
- Also each state can have its own * format * . Those can be configured via * format-<name> * . Or if you want to differentiate a bit more even as * format-<status>-<state> * . For more information see * custom-formats * .
2019-08-24 17:44:29 +01:00
2025-06-22 12:45:28 +02:00
# EVENTS
Every entry in the * events * object consists of a * <event-name> * (typeof: * string * ) and a * <command> * (typeof: * string * ). ++
* <event-name> * can be in one of the following formats:
- * on-<status>-<state> *
- * on-<status>-<capacity> *
Where:
- * <status> * is either * charging * or * discharging * ,
- * <state> * is the name of one of the states specified in the * states * object,
- * <capacity> * is a battery level value (between * 0-100 * ).
2019-08-24 17:44:29 +01:00
2019-08-26 22:28:24 +01:00
# EXAMPLES
2019-08-24 17:44:29 +01:00
```
"battery": {
2023-07-30 17:33:02 +02:00
"bat": "BAT2",
"interval": 60,
"states": {
"warning": 30,
"critical": 15
},
2025-06-22 12:45:28 +02:00
"events": {
"on-discharging-warning": "notify-send -u normal 'Low Battery'",
"on-discharging-critical": "notify-send -u critical 'Very Low Battery'",
"on-charging-100": "notify-send -u normal 'Battery Full!'"
},
2023-07-30 17:33:02 +02:00
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""],
"max-length": 25
2019-08-24 17:44:29 +01:00
}
```
2019-08-24 21:46:56 +01:00
# STYLE
2019-08-24 17:44:29 +01:00
- * #battery *
- * #battery.<status> *
- * <status> * is the value of /sys/class/power_supply/<bat>/status in lowercase.
- * #battery.<state> *
- * <state> * can be defined in the * config * . For more information see * states * .
- * #battery.<status>.<state> *
- Combination of both * <status> * and * <state> * .
2024-01-19 14:45:49 +05:30
The following classes are applied to the entire Waybar rather than just the
battery widget:
- * window#waybar.battery-<state> *
- * <state> * can be defined in the * config * , as previously mentioned.