Skip to content

battery ​

Battery level, charging state, and a dropdown with power-profile controls.

WARNING

This module uses upower (D-Bus) for battery information. Ensure upower daemon is running and exposes a battery device (verify with upower --battery or upower --dump).

Add it to your layout with battery:

yaml
bar:
  layout:
    - monitor: "*"
      right: [battery]

General ​

FieldTypeDefaultDescription
level-iconsarray of string[...]Icons for battery levels from empty to full.
charging-iconstring"ld-battery-charging-symbolic"Icon shown when battery is charging.
alert-iconstring"ld-battery-warning-symbolic"Icon shown when battery is not present or in an error state.
border-showboolfalseDisplay border around button.
icon-showbooltrueDisplay module icon.
label-showbooltrueDisplay percentage label.
formatstring"{{ percent }}%"Format string for the label.
label-max-lengthu320Max label characters before truncation with ellipsis. Set to 0 to disable.
thresholdsarray of ThresholdEntry[]Dynamic color thresholds based on battery percentage.
More about level-icons

The percentage is divided evenly among icons. With 5 icons: 0-20% uses icons[0], 21-40% uses icons[1], etc.

More about format

Placeholders ​

  • {{ percent }} - Battery level (0-100)

Examples ​

  • "{{ percent }}%" - "45%"
More about thresholds

Entries are checked in order; the last matching entry wins for each color slot. Use below for low-value warnings (e.g., low battery).

Example ​

yaml
modules:
  battery:
    thresholds:
      - below: 40
        icon-color: status-warning
      - below: 20
        icon-color: status-error
        label-color: status-error

Colors ​

FieldTypeDefaultDescription
border-colorColorValue"yellow"Border color token.
icon-colorColorValue"auto"Icon foreground color. Auto selects based on variant for contrast.
icon-bg-colorColorValue"yellow"Icon container background color token.
label-colorColorValue"fg-default"Label text color token.
button-bg-colorColorValue"bg-surface-elevated"Button background color token.

Click actions ​

FieldTypeDefaultDescription
left-clickClickAction"dropdown:battery"Action on left click.
right-clickClickAction""Action on right click.
middle-clickClickAction""Action on middle click.
scroll-upClickAction""Action on scroll up.
scroll-downClickAction""Action on scroll down.

Default configuration ​

yaml
modules:
  battery:
    level-icons:
      - ld-battery-symbolic
      - ld-battery-low-symbolic
      - ld-battery-medium-symbolic
      - ld-battery-full-symbolic
    charging-icon: ld-battery-charging-symbolic
    alert-icon: ld-battery-warning-symbolic
    border-show: false
    border-color: yellow
    icon-show: true
    icon-color: auto
    icon-bg-color: yellow
    label-show: true
    label-color: fg-default
    format: '{{ percent }}%'
    label-max-length: 0
    button-bg-color: bg-surface-elevated
    left-click: dropdown:battery
    right-click: ""
    middle-click: ""
    scroll-up: ""
    scroll-down: ""
    thresholds: []

Released under the MIT License.