LinuxCommandLibrary

cbatticon

Display battery status icon in system tray

TLDR

Show the battery icon in the system tray

$ cbatticon
copy

Show the battery icon and set the update interval to 20 seconds
$ cbatticon [[-u|--update-interval]] [20]
copy

List available icon types
$ cbatticon [[-t|--list-icon-types]]
copy

Show the battery icon with a specific icon type
$ cbatticon [[-i|--icon-type]] [standard|notification|symbolic]
copy

List available power supplies
$ cbatticon [[-p|--list-power-supplies]]
copy

Show the battery icon for a specific battery
$ cbatticon [BAT0]
copy

Show the battery icon and which command to execute when the battery level reaches the set critical level
$ cbatticon [[-r|--critical-level]] [5] [[-c|--command-critical-level]] [poweroff]
copy

SYNOPSIS

cbatticon [-h] [-d] [-i dir] [-t thresh] [-u secs] [-w pct] [-c pct] [-x] [-b] [-r] [-v]

PARAMETERS

-h
    Show help and exit

-d
    Print debug info to stdout

-i dir
    Icon directory (default: /usr/share/cbatticon)

-t thresh
    Full icon threshold percent (default: 100)

-u secs
    Update interval in seconds (default: 10)

-w pct
    Warning percentage (default: 30)

-c pct
    Critical percentage (default: 5)

-x
    Exit on critical battery

-b
    Use bigger icons

-r
    Reverse icon order (AC first)

-v
    Show version

DESCRIPTION

cbatticon is a simple, efficient command-line daemon that displays battery status icons in the X11 system tray.

Designed for lightweight window managers like i3, bspwm, or Openbox, it monitors battery charge via UPower or ACPI, showing color-coded icons (green for full, yellow for medium, red for low).

Features include customizable update intervals, low-battery warnings with notifications and sounds, critical thresholds triggering exit or alerts, and support for multiple batteries (e.g., laptop + UPS).

It uses minimal resources, runs unobtrusively in the background, and supports custom icon sets. Ideal for users avoiding heavy desktop environments while needing clear battery visibility.

Launch it once at session start; it handles charging/discharging states automatically.

CAVEATS

X11 systray only (no Wayland support).
Requires icons package or manual setup.
Multiple batteries may need configuration.

DEPENDENCIES

libnotify, libX11; optional: alsa-utils for sounds, cbatticon-icons package

USAGE TIP

Add to ~/.xinitrc or WM autostart: cbatticon -u 5 -w 20

HISTORY

Developed by MichaƂ Dybczak since 2013.
Originally for personal use in i3wm; open-sourced on GitHub.
Actively maintained with UPower support added later.

SEE ALSO

acpi(1), upower(1), notify-send(1)

Copied to clipboard