Battery State displays your FreeBSD laptop battery status in text styleat


The Battery State application can be integrated in any WM application who accepts text style output like wmii, ratpoison and many others. The application was wrote for FreeBSD in plain C and uses the sysctl interface to query the battery state.



battery.c: Download the source code


The code is delivered under BSD License

Implementation details

The information about the battery state are provided by the “” sysctl.

Those values are the power remaining in the battery in percent, and the charging state as a numeric value as displayed in the following array.

Value State Description
1 Discharging We are using the battery
2 Charging We are charging the battery
4 Critical Something really weird, but what
7 Not present / max Another unknown state