xmobar battery plugin using sysfs, not procfs

As the lastest kernel image (2.6.29-1) on Debian Sid did not have CONFIG_ACPI_PROCFS_POWER enabled by default, the battery plugin of xmobar, a status bar application for xmonad, stopped working.

I could easily think of two options: (1) recompile the kernel image with CONFIG_ACPI_PROCFS_POWER enabled, or (2) write a xmobar plugin that does not depend on procfs. After giving a bit of thought to it, I decided to write a xmobar plugin that does not depend on procfs. It seemed that procfs was deprecated and, in a long run, sysfs would be preferred over procfs.

The plugin, SysfsBatt.hs, has been written, and Monitors.hs has been modified.

In order to recompile xmobar with the above files, you could simply follow these steps, assuming that you are in the xmobar src directory:
  1. $ cd Plugins/Monitors
  2. $ wget http://www.cse.unsw.edu.au/~seanl/misc/SysfsBatt.hs
  3. $ cd ..
  4. $ wget http://www.cse.unsw.edu.au/~seanl/misc/Monitors.hs
  5. $ runhaskell Setup.lhs configure
  6. $ runhaskell Setup.lhs build
  7. $ runhaskell Setup.lhs install
My .xmobarrc uses SysfsBatt in case an example is needed.

29 Mar 2009 | Permalink | haskell, sysfs, xmobar, xmonad.

plants