2019-08-24 16:44:29 +00: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 20:46:56 +00:00
# CONFIGURATION
2020-04-12 16:41:44 +00:00
*bat*: ++
2019-08-24 16:44:29 +00:00
typeof: string ++
The battery to monitor, as in /sys/class/power_supply/ instead of auto detect.
2020-04-12 16:41:44 +00:00
*adapter*: ++
2019-08-24 16:44:29 +00:00
typeof: string ++
The adapter to monitor, as in /sys/class/power_supply/ instead of auto detect.
2020-04-12 16:41:44 +00:00
*full-at*: ++
2020-04-05 14:56:51 +00: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 14:56:51 +00:00
2021-01-03 14:25:19 +00:00
*design-capacity*: ++
2023-07-30 15:33:02 +00:00
typeof: bool ++
default: false ++
2023-10-21 15:45:25 +00:00
Option to use the battery design capacity instead of its current maximal capacity.
2021-01-03 14:25:19 +00:00
2020-04-12 16:41:44 +00:00
*interval*: ++
2019-08-24 16:44:29 +00:00
typeof: integer ++
default: 60 ++
The interval in which the information gets polled.
2020-04-12 16:41:44 +00:00
*states*: ++
2022-11-07 07:30:01 +00:00
typeof: object ++
2019-08-24 16:44:29 +00:00
A number of battery states which get activated on certain capacity levels. See *waybar-states(5)*.
2020-04-12 16:41:44 +00:00
*format*: ++
2019-08-24 16:44:29 +00:00
typeof: string ++
default: {capacity}% ++
2022-07-15 08:01:14 +00:00
The format, how information should be displayed.
2019-08-24 16:44:29 +00:00
2020-04-12 16:41:44 +00:00
*format-time*: ++
2019-09-06 18:53:43 +00:00
typeof: string ++
default: {H} h {M} min ++
The format, how the time should be displayed.
2020-01-04 03:31:24 +00:00
*format-icons*: ++
typeof: array/object ++
2019-08-24 16:44:29 +00: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 03:31:24 +00:00
*max-length*: ++
2019-08-24 16:44:29 +00:00
typeof: integer++
The maximum length in character the module should display.
2021-02-01 16:34:51 +00:00
*min-length*: ++
2023-07-30 15:33:02 +00:00
typeof: integer ++
2023-10-21 15:45:25 +00:00
The minimum length in characters the module should accept.
2021-02-01 16:34:51 +00:00
*align*: ++
2023-07-30 15:33:02 +00:00
typeof: float ++
2024-03-06 15:10:09 +00: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 16:34:51 +00:00
2020-01-04 03:31:24 +00:00
*rotate*: ++
2019-08-24 16:44:29 +00:00
typeof: integer++
Positive value to rotate the text label.
2020-01-04 03:31:24 +00:00
*on-click*: ++
2019-08-24 16:44:29 +00:00
typeof: string ++
Command to execute when clicked on the module.
2019-12-29 04:19:45 +00:00
*on-click-middle*: ++
typeof: string ++
Command to execute when middle-clicked on the module using mousewheel.
2020-04-12 16:35:41 +00:00
*on-click-right*: ++
2019-08-24 16:44:29 +00:00
typeof: string ++
2023-10-21 15:45:25 +00:00
Command to execute when you right-click on the module.
2019-08-24 16:44:29 +00:00
2020-04-12 16:35:41 +00:00
*on-update*: ++
typeof: string ++
Command to execute when the module is updated.
2020-01-04 03:31:24 +00:00
*on-scroll-up*: ++
2019-08-24 16:44:29 +00:00
typeof: string ++
Command to execute when scrolling up on the module.
2020-01-04 03:31:24 +00:00
*on-scroll-down*: ++
2019-08-24 16:44:29 +00:00
typeof: string ++
Command to execute when scrolling down on the module.
2020-04-12 16:41:44 +00:00
*smooth-scrolling-threshold*: ++
2019-08-24 16:44:29 +00:00
typeof: double ++
Threshold to be used when scrolling.
2020-04-12 16:41:44 +00:00
*tooltip*: ++
2019-08-24 16:44:29 +00:00
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
2023-09-12 16:39:09 +00:00
*bat-compatibility*: ++
typeof: bool ++
default: false ++
Option to enable battery compatibility if not detected.
2019-08-24 20:46:56 +00:00
# FORMAT REPLACEMENTS
2019-08-24 16:44:29 +00:00
*{capacity}*: Capacity in percentage
2021-01-24 20:49:00 +00:00
*{power}*: Power in watts
2019-08-24 16:44:29 +00: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.
2019-09-06 18:53:43 +00:00
# TIME FORMAT
The *battery* module allows you to define how time should be formatted via *format-time*.
2022-01-29 18:29:57 +00:00
The three arguments are:
2019-09-06 18:53:43 +00:00
*{H}*: Hours
*{M}*: Minutes
2022-01-29 18:29:57 +00:00
*{m}*: Zero-padded minutes
2019-09-06 18:53:43 +00:00
2019-08-24 20:46:56 +00:00
# CUSTOM FORMATS
2019-08-24 16:44:29 +00:00
2023-10-21 15:45:25 +00:00
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 16:44:29 +00: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 20:46:56 +00:00
# STATES
2019-08-24 16:44:29 +00:00
- Every entry (*state*) consists of a *<name>* (typeof: *string*) and a *<value>* (typeof: *integer*).
2023-10-21 15:45:25 +00:00
- 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 16:44:29 +00:00
2019-08-26 21:28:24 +00:00
# EXAMPLES
2019-08-24 16:44:29 +00:00
```
"battery": {
2023-07-30 15:33:02 +00:00
"bat": "BAT2",
"interval": 60,
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""],
"max-length": 25
2019-08-24 16:44:29 +00:00
}
```
2019-08-24 20:46:56 +00:00
# STYLE
2019-08-24 16:44:29 +00: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-03-05 15:04:59 +00:00
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.