xosd-battery: a minimalistic battery monitor for X11

WARNING: This project is no longer maintained. See xstatbar for a maintained replacement.


xosd-battery is a simple, text-only battery monitor for X11 that uses the XOSD library to render the current percentage of battery power remaining, and current power source (battery or AC), to the X11 root window. All information is queried via sysctl(3).


The sysctl-names for the current and maximum charge, and the sysctl for the power indicator (if using AC or Battery for power) must be specified on the command line. These sysctl's are identical to what one would type on the command line when using sysctl(8).

Additional sysctl's can be specified for warning and low capacity measurements.

Additionally, you can specify how often to update the display, the color/font used, the position (x/y offsets and alignment), shadowing, and outline.


Click here to see a simple screenshot (warning: the file is big... scaling it down distorts the battery display).
Note that the clock is in the lower-right corner of the screen, in green.
That battery display is generated by the following command in my .xinitrc file
      /usr/local/bin/xosd-battery -x -1 -y -1 -z 30 -b black \
                                  -n hw.sensors.acpibat0.watthour3 \
                                  -m hw.sensors.acpibat0.watthour0 \
                                  -i hw.sensors.acpiac0.indicator0 \
                                  -w hw.sensors.acpibat0.watthour1 \
                                  -l hw.sensors.acpibat0.watthour2 &
Shameless plug...
In this screenshot, you'll notice my xosd-systat program in the top-left of the screen and my xosd-clock program in the upper-right corner.


First, make sure you have the XOSD library installed on your system. Most operating systems have easily installable package for this.

Then download the file below and simply
  1. tar xvzf xosd-battery.tar.gz
  2. cd xosd-battery
  3. make install
Type make uninstall, or simply remove the program and man-page, which are by default installed as
See the man page here: xosd-battery(1).


Here: xosd-battery.tar.gz.
Copyright (c) 2008 Ryan Flannery <ryan.flannery@gmail.com>