mirror of
https://github.com/Alexays/Waybar.git
synced 2026-06-10 07:51:39 +00:00
Page:
Module: Battery
Pages
Abrar's Waybar
Add a custom plugin.
Anik's waybar config (super waybar)
Ariacna Æsama
Arkboi
Chocolate & Cream
Configuration
Dynamic wallust powered waybar
ERS’ waybar
Examples
FAQ
Home
Installation
JohanChane's waybar
Module: Backlight Slider
Module: Backlight
Module: Battery
Module: Bluetooth
Module: CFFI
Module: CPU
Module: Cava
Module: Cava: GLSL
Module: Cava: Raw
Module: Clock
Module: Custom
Module: Custom: Examples
Module: Custom: Menu
Module: Disk
Module: Dwl
Module: Gamemode
Module: Group
Module: Hyprland
Module: Idle Inhibitor
Module: Image
Module: JACK
Module: Keyboard State
Module: Language
Module: Load
Module: MPD
Module: MPRIS
Module: Memory
Module: Network
Module: Niri
Module: PowerProfilesDaemon
Module: Privacy
Module: PulseAudio Slider
Module: PulseAudio
Module: River
Module: Sndio
Module: Sway
Module: Systemd failed units
Module: Taskbar
Module: Temperature
Module: Tray
Module: UPower
Module: User
Module: Wayfire
Module: WirePlumber
Module: Workspaces
Modules
Simple and Attractive
States
Styling
That's all bitches
Themes
Thos' config based on pywal
Tray Applets
Writing Modules
apachaiz's waybar
d00m1k's configuration
lingllqs's simple dark style configuration
mechabar
mudi4's waybar
new waylyrics
nitrobigchill's waybar
rdk‐codes configuration
waybar config
No results
Table of Contents
The battery module displays the current capacity and state (eg. charging) of your battery.
Config
Addressed by 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. |
|
design-capacity |
bool | false |
Option to enable the use of the design capacity instead of the actual maximal capacity. Thus, even full, the battery may be at less than 100%. |
full-at |
integer | Define the max percentage of the battery, useful for an old battery, e.g. 96 | |
interval |
integer | 60 | The polling interval (in seconds) for the battery status. |
states |
array/object | A number of battery states which get activated on certain capacity levels. See States |
|
format |
string | {capacity}% |
The format, how the information should be displayed. |
format-time |
string | {H} h {M} min |
The format of the estimate of time until full or empty. Use {m} for zero-padded minutes. |
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 characters) the module should display. | |
rotate |
integer | Positive value to rotate the text label. | |
on-click |
string | Command to execute when clicking the module. | |
on-click-middle |
string | Command to execute when you middle click on the module using the mousewheel. | |
on-click-right |
string | Command to execute when you right click on the module. | |
on-scroll-up |
string | Command to execute when scrolling up on the module. | |
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 enable tooltip on hover. |
tooltip-format |
string | {timeTo} |
The tooltip format. |
weighted-average |
bool | true |
For devices with multiple batteries, an option to display the percentage as an average weighted by the size of the batteries, rather than a simple average of their percentage levels |
bat-compatibility |
bool | false |
Option to enable battery compatibility if not detected. |
Format replacements:
| string | replacement |
|---|---|
{capacity} |
Capacity in percentage |
{power} |
Power draw 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} |
The amount of charge cycles the highest-capacity battery has seen (Linux only) |
Custom Formats:
The battery module allows to define custom formats based on up to two factors. The best fitting format will be selected.
| format | description |
|---|---|
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. |
Custom Tooltip Formats:
The tooltip format can be changed similarly to the label format. 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-*). Valid tooltip format replacements are as follows:
| string | replacement |
|---|---|
{capacity} |
Capacity in percentage |
{power} |
Power draw in watts |
{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. |
{timeTo} |
Either an estimate of time until full or empty, or "Full", "Plugged" or "Empty" depending on the current battery status |
{cycles} |
The amount of charge cycles the highest-capacity battery has seen (Linux only) |
{health} |
A percentage representing the highest-capacity battery's current maximum charge relative to it's design capacity (Linux only) |
States:
- 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 or below the configured<value>. - Also each state can have its own
format. Those can be configured viaformat-<name>. Or if you want to differentiate a bit more even asformat-<status>-<state>. For more information see custom formats.
- The state can be addressed as a CSS class in the
Example:
"battery": {
"bat": "BAT2",
"interval": 60,
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""],
"max-length": 25
}
Custom icon set depending on <state>:
"battery": {
"bat": "BAT2",
"interval": 60,
"format": "{capacity}% {icon}",
"format-icons": {
"default": ["", "", "", "", "", "", "", "", "", "", ""],
"charging": ["", "", "", "", "", "", "", "", "", "", ""]
},
}
Style
#battery#battery.<status><status>is the value of/sys/class/power_supply/<bat>/statusin lowercase.
#battery.<state><state>can be defined in theconfig. For more information seestates
#battery.<status>.<state>- Combination of both
<status>and<state>.
- Combination of both
The following classes can apply styles to the entire Waybar:
window#waybar.battery-<state><state>can be defined in theconfig, as previously mentioned.
- Home
- Installation
- Configuration
- Styling
- Examples
- FAQ
- Modules:
- Backlight/Slider
- Backlight
- Battery
- Bluetooth
- CPU
- Cava
- CFFI
- Clock
- Custom
- DWL
- Disk
- Gamemode
- Group
- Hyprland
- Idle Inhibitor
- Image
- JACK
- Keyboard State
- Language
- Load
- 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
- Writing Modules
License
Waybar is licensed under the MIT license. See LICENSE for more information.