XMobar-friendly low-battery warning

batterylaptopxmonad

I'm in the process of setting up a laptop running Debian Jesse with xmonad as the display manager. I use xmobar to display information about the current state of the system, including the battery level. However, I find that I forget to check regularly and I'm always surprised when my computer suddenly shuts off because the battery died — I miss the pop-up notifications that I used to get with XFCE.

What can I use to get an attention-grabbing warning about my low battery? Most solutions I've found use dzen, or just display a number on the status bar, which I've found to be insufficient.

Best Answer

This is no ready solution, but an idea: I would use osd_cat which comes in the package xosd in Fedora Linux together with a cronjob, that checks your battery status.

You can edit your cronjobs with

crontab -e

and you find your battery status in /sys/class/power_supply/, and there it is in my case BAT1/ with some files charge_now and charge_full. With those files, that is with

/sys/class/power_supply/BAT1/charge_now
/sys/class/power_supply/BAT1/charge_full

you could find the percentage remaining in your battery, which could then show you a big message with osd_cat (onscreen display).

Related Question