1waybar-battery(5) File Formats Manual waybar-battery(5)
2
3
4
6 waybar - battery module
7
9 The battery module displays the current capacity and state (eg. charg‐
10 ing) of your battery.
11
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 it's 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 take up.
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 clicked 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
113 {capacity}: Capacity in percentage
114
115 {power}: Power in watts
116
117 {icon}: Icon, as defined in format-icons.
118
119 {time}: Estimate of time until full or empty. Note that this is based
120 on the power draw at the last refresh time, not an average.
121
123 The battery module allows you to define how time should be formatted
124 via format-time.
125
126 The three arguments are: {H}: Hours {M}: Minutes {m}: Zero-padded min‐
127 utes
128
130 The battery module allows one to define custom formats based on up to
131 two factors. The best fitting format will be selected.
132
133 format-<state>: With states, a custom format can be set depending on
134 the capacity of your battery.
135
136 format-<status>: With the status, a custom format can be set depending
137 on the status in /sys/class/power_supply/<bat>/status (in lowercase).
138
139 format-<status>-<state>: You can also set a custom format depending on
140 both values.
141
143 • Every entry (state) consists of a <name> (typeof: string) and a
144 <value> (typeof: integer).
145 • The state can be addressed as a CSS class in the style.css. The
146 name of the CSS class is the <name> of the state. Each class gets
147 activated when the current capacity is equal or below the config‐
148 ured <value>.
149 • Also each state can have its own format. Those con be configured
150 via format-<name>. Or if you want to differentiate a bit more even
151 as format-<status>-<state>. For more information see custom-for‐
152 mats.
153
154
156 "battery": {
157 "bat": "BAT2",
158 "interval": 60,
159 "states": {
160 "warning": 30,
161 "critical": 15
162 },
163 "format": "{capacity}% {icon}",
164 "format-icons": ["", "", "", "", ""],
165 "max-length": 25
166 }
167
169 • #battery
170 • #battery.<status>
171 • <status> is the value of /sys/class/power_supply/<bat>/status
172 in lowercase.
173 • #battery.<state>
174 • <state> can be defined in the config. For more information see
175 states.
176 • #battery.<status>.<state>
177 • Combination of both <status> and <state>.
178
179
180
181 2023-08-16 waybar-battery(5)