-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Module: Battery
Note
This page is auto-generated from man/waybar-battery.5.scd on the master branch.
Do not edit it here — changes will be overwritten on the next sync.
To update it, edit the man page(s) and open a PR.
The battery module displays the current capacity and state (eg. charging) of your battery.
| Option | Typeof | Default | Description |
|---|---|---|---|
| bat | string | The battery to monitor, as in /sys/class/power_supply/ instead of auto detect. | |
| adapter | string | The adapter to monitor, as in /sys/class/power_supply/ instead of auto detect. | |
| full-at | integer | 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%. | |
| design-capacity | bool | false | Option to use the battery design capacity instead of its current maximal capacity. |
| full-at-plugged | bool | false | When enabled, a battery that is Full while the adapter is online is reported with the Plugged status instead of Full (so you can style/format it separately). Disabled by default to preserve the existing Full behaviour. |
| interval | integer | 60 | The interval in which the information gets polled. |
| smooth-power | bool | false | Enable exponential smoothing of the battery power reading used to estimate the {time} remaining, so the estimate fluctuates less between refreshes. |
| smooth-power-time-constant | double | 260.0 | The time constant (in seconds) of the smooth-power exponential filter. Only used when smooth-power is enabled. Values below 1.0 are clamped to 1.0. |
| states | object | A number of battery states which get activated on certain capacity levels. See waybar-states(5). | |
| format | string | {capacity}% | The format, how information should be displayed. |
| format-time | string | {H} h {M} min | The format, how the time should be displayed. |
| format-icons | array/object | 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. | |
| max-length | integer | The maximum length in character the module should display. | |
| min-length | integer | The minimum length in characters the module should accept. | |
| align | float | 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 | string | The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning. | |
| rotate | integer | Positive value to rotate the text label (in 90 degree increments). | |
| on-click | string | Command to execute when clicked on the module. | |
| on-click-middle | string | Command to execute when middle-clicked on the module using mousewheel. | |
| on-click-right | string | Command to execute when you right-click on the module. | |
| on-update | string | Command to execute when the module is updated. | |
| on-scroll-up | string | Command to execute when scrolling up on the module. | |
| weighted-average | bool | true | Option to combine multiple batteries with different capacities. |
| on-scroll-down | string | Command to execute when scrolling down on the module. | |
| smooth-scrolling-threshold | double | Threshold to be used when scrolling. | |
| tooltip | bool | true | Option to disable tooltip on hover. |
| tooltip-format | string | {timeTo} | The tooltip format. See CUSTOM FORMATS for status/state-specific variants. |
| bat-compatibility | bool | false | Option to enable battery compatibility if not detected. |
| menu | string | Action that popups the menu. | |
| menu-file | string | Location of the menu descriptor file. There need to be an element of type GtkMenu with id menu. | |
| menu-actions | array | The actions corresponding to the buttons of the menu. | |
| expand | bool | false | Enables this module to consume all left over space dynamically. |
| events | object | Specifies commands to be executed on specific battery states. See EVENTS section below. |
{capacity}: Capacity in percentage
{power}: Power in watts
{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.
{cycles}: Amount of charge cycles the highest-capacity battery has seen. (Linux only)
{health}: The percentage of the highest-capacity battery's original maximum charge it can still hold.
The following additional replacement is available in tooltip-format (and its custom variants) only:
{timeTo}: Either an estimate of time until full or empty, or "Full", "Plugged" or "Empty" depending on the current battery status.
The battery module allows you to define how time should be formatted via format-time.
The three arguments are: {H}: Hours {M}: Minutes {m}: Zero-padded minutes
The battery module allows one to define custom formats based on up to two factors. The best-fitting format will be selected.
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.
The tooltip format can be customized the same way. The best fitting from tooltip-format, tooltip-format-<state>, tooltip-format-<status> and tooltip-format-<status>-<state> will be used (using the same logic as format-*).
-
Every entry (state) consists of a <name> (typeof: string) and a <value> (typeof: integer).
-
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.
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>
-
on-<status>
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).
"battery": {
"bat": "BAT2",
"interval": 60,
"states": {
"warning": 30,
"critical": 15
},
"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!'",
"on-discharging": "notify-send -u normal 'Power Switch' Discharging",
"on-charging": "notify-send -u normal 'Power Switch' Charging'"
},
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""],
"max-length": 25
}
Custom icon set depending on the status (format-icons as an object):
"battery": {
"bat": "BAT2",
"interval": 60,
"format": "{capacity}% {icon}",
"format-icons": {
"default": ["", "", "", "", "", "", "", "", "", "", ""],
"charging": ["", "", "", "", "", "", "", "", "", "", ""]
}
}
-
#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>.
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.
- Home
- Installation
- Configuration
- Styling
- Examples
- FAQ
- Modules:
- Backlight/Slider
- Backlight
- Battery
- Bluetooth
- CPU
- Cava
- CFFI
- Clock
- Custom
- DWL
- Disk
- Gamemode
- GPS
- Group
- Hyprland
- Idle Inhibitor
- Image
- Inhibitor
- JACK
- Keyboard State
- Language
- Load
- Mango
- Menu
- MPD
- MPRIS
- Memory
- Network
- Niri
- Power Profiles Daemon
- Privacy
- PulseAudio/Slider
- PulseAudio
- River
- Sndio
- Sway
- Systemd failed units
- Taskbar
- Temperature
- Tray
- UPower
- User
- Wayfire
- WirePlumber
- Workspaces
- WWAN
- Writing Modules