1waybar-battery(5)             File Formats Manual            waybar-battery(5)
2
3
4

NAME

6       waybar - battery module
7

DESCRIPTION

9       The battery module displays the current capacity and state (eg. charg‐
10       ing) of your battery.
11

CONFIGURATION

13       bat:
14            typeof: string
15            The battery to monitor, as in /sys/class/power_supply/ instead of
16       auto detect.
17
18       adapter:
19            typeof: string
20            The adapter to monitor, as in /sys/class/power_supply/ instead of
21       auto detect.
22
23       full-at:
24            typeof: integer
25            Define the max percentage of the battery, for when you've set the
26       battery to stop charging at a lower level to save it. For example, if
27       you've set the battery to stop at 80% that will become the new 100%.
28
29       design-capacity:
30            typeof: bool
31            default: false
32            Option to use the battery design capacity instead of its current
33       maximal capacity.
34
35       interval:
36            typeof: integer
37            default: 60
38            The interval in which the information gets polled.
39
40       states:
41            typeof: object
42            A number of battery states which get activated on certain capacity
43       levels. See waybar-states(5).
44
45       format:
46            typeof: string
47            default: {capacity}%
48            The format, how information should be displayed.
49
50       format-time:
51            typeof: string
52            default: {H} h {M} min
53            The format, how the time should be displayed.
54
55       format-icons:
56            typeof: array/object
57            Based on the current capacity, the corresponding icon gets se‐
58       lected.
59            The order is low to high. Or by the state if it is an object.
60
61       max-length:
62            typeof: integer
63            The maximum length in character the module should display.
64
65       min-length:
66            typeof: integer
67            The minimum length in characters the module should accept.
68
69       align:
70            typeof: float
71            The alignment of the text, where 0 is left-aligned and 1 is right-
72       aligned. If the module is rotated, it will follow the flow of the text.
73
74       rotate:
75            typeof: integer
76            Positive value to rotate the text label.
77
78       on-click:
79            typeof: string
80            Command to execute when clicked on the module.
81
82       on-click-middle:
83            typeof: string
84            Command to execute when middle-clicked on the module using mouse‐
85       wheel.
86
87       on-click-right:
88            typeof: string
89            Command to execute when you right-click on the module.
90
91       on-update:
92            typeof: string
93            Command to execute when the module is updated.
94
95       on-scroll-up:
96            typeof: string
97            Command to execute when scrolling up on the module.
98
99       on-scroll-down:
100            typeof: string
101            Command to execute when scrolling down on the module.
102
103       smooth-scrolling-threshold:
104            typeof: double
105            Threshold to be used when scrolling.
106
107       tooltip:
108            typeof: bool
109            default: true
110            Option to disable tooltip on hover.
111
112       bat-compatibility:
113            typeof: bool
114            default: false
115            Option to enable battery compatibility if not detected.
116

FORMAT REPLACEMENTS

118       {capacity}: Capacity in percentage
119
120       {power}: Power in watts
121
122       {icon}: Icon, as defined in format-icons.
123
124       {time}: Estimate of time until full or empty. Note that this is based
125       on the power draw at the last refresh time, not an average.
126

TIME FORMAT

128       The battery module allows you to define how time should be formatted
129       via format-time.
130
131       The three arguments are: {H}: Hours {M}: Minutes {m}: Zero-padded min‐
132       utes
133

CUSTOM FORMATS

135       The battery module allows one to define custom formats based on up to
136       two factors. The best-fitting format will be selected.
137
138       format-<state>: With states, a custom format can be set depending on
139       the capacity of your battery.
140
141       format-<status>: With the status, a custom format can be set depending
142       on the status in /sys/class/power_supply/<bat>/status (in lowercase).
143
144       format-<status>-<state>: You can also set a custom format depending on
145       both values.
146

STATES

148       •   Every entry (state) consists of a <name> (typeof: string) and a
149           <value> (typeof: integer).
150       •   The state can be addressed as a CSS class in the style.css. The
151           name of the CSS class is the <name> of the state.   Each class gets
152           activated when the current capacity is equal to or below the con‐
153           figured <value>.
154       •   Also each state can have its own format. Those can be configured
155           via format-<name>. Or if you want to differentiate a bit more even
156           as format-<status>-<state>. For more information see custom-for‐
157           mats.
158
159

EXAMPLES

161           "battery": {
162                "bat": "BAT2",
163                "interval": 60,
164                "states": {
165                     "warning": 30,
166                     "critical": 15
167                },
168                "format": "{capacity}% {icon}",
169                "format-icons": ["", "", "", "", ""],
170                "max-length": 25
171           }
172

STYLE

174#battery
175#battery.<status>
176<status> is the value of /sys/class/power_supply/<bat>/status
177               in lowercase.
178#battery.<state>
179<state> can be defined in the config. For more information see
180               states.
181#battery.<status>.<state>
182           •   Combination of both <status> and <state>.
183
184
185
186                                  2023-11-05                 waybar-battery(5)
Impressum