Skip to content

Battery

Jake Stanger edited this page May 31, 2026 · 7 revisions

Displays system power information such as the battery percentage, and estimated time to empty.

Note

This module requires that upower is installed and its service running.

TODO: ADD SCREENSHOT

Configuration

Type: battery

Name Type Default Profile? Description
format string {percentage}% Yes Format string to use for the widget button label.
icon_size integer 24 No Size to render icon at.
show_icon boolean true No Whether to show the icon.
show_label boolean true No Whether to show the label.
use_default_profiles boolean true No Whether default profiles should be used.

This module uses a compound threshold with 1-2 values for profiles:

  • percent - 0-100
  • charging - true/false (optional)

Information on the profiles system can be found here.

JSON
{
  "end": [
    {
      "type": "battery",
      "format": "{percentage}%",
      "profiles": {
        "warning":  { "percent":  20 },
        "critical": {
          "when": { "percent":  5, "charging": false },
          "format": "[LOW] {percentage}%"
        }
      }
    }
  ]
}
TOML
[[end]]
type = "battery"
format = "{percentage}%"

[end.profiles.warning]
percent = 20

[end.profiles.critical]
when = { percent = 5, charging = false }
format = "[LOW] {percentage}%"
YAML
end:
  - type: "battery"
    format: "{percentage}%"
    profiles:
      warning:
        percent: 20
      critical:
        when:
          percent: 5
          charging: false
        format: "[LOW] {percentage}%"
Corn
{
  end = [
    {
      type = "battery"
      format = "{percentage}%"
      profiles.warning.percent = 20
      
      profiles.critical.when = { percent = 5 charging = false }
      profiles.critical.format = "[LOW] {percentage}%"
    }
  ]
}

Default profiles

This module does not include any default profiles.

Formatting Tokens

The following tokens can be used in the format config option, and will be replaced with values from the current battery state:

Token Description
{percentage} The battery charge percentage.
{state} The current battery (dis)charging state.
{time_remaining} The ETA to battery empty or full.

Styling

Selector Description
.battery Battery widget button.
.battery.<threshold> Battery widget button (dynamic threshold class)
.battery .contents Battery widget button contents.
.battery .icon Battery widget battery icon.
.battery .label Battery widget button label.
.popup-battery Battery popup box.
.popup-battery .details Label inside the popup.

For more information on styling, please see the styling guide.

Clone this wiki locally