Simple battery monitor for fbpanel
I realised that fbpanel didn't have a default battery monitor and I got sick of opening a shell and typing "acpi -V" all the time, well actually I am lazy and forgot and had a few Homer moments and lost bits of work. So I knocked up this script for fbpanel.
On Debian it requires libnotify-bin for the send-notify to work correctly and here is the battery icon. You will need to place both in a directory called "bin" in your home directory and make sure both the directory bin and the script are executable (chmod +x battery etc) and in your $PATH.
The fbpanel bit is added to ~/.fbpanel/default
Make sure you back it up first eh?
Plugin {
type = genmon
config {
Command = ~/bin/battery
PollingTime = 60
TextSize = xx-small
TextColor = white
}
}
Command is obviously a call to the script
PollingTime is how often it is run (in secs)
TextSize is obvious along with TextColor
You'll need to restart the panel so open a shell and:
killall fbpanel && fbpanel &
This will gracefully stop and restart the panel to a background job.
If you're using this on something other than a notebook then you'll have to mess with the coordinates of the notifications. I've set the script to notify on anything below 11% (it's adequate for me and keeps the script simple) feel free to adjust to your needs. In fact you can safely remove it if you just want to sit in the bottom right (default). I think the script is easy to understand but ask away if you don't get anything or indeed have a better way of doing it.
Spicing it up, of course you can add sound notifications to it, or if you're a festival user you can add something like:
echo "Battery Low"| festival --tts
if like me you've constantly got headphones in to the end of the notification. Beware if you've got a busy CPU you may end up with race conditions.
Known Issues: Incorrect string when less than 10% - might fix it but since 10% = 20mins on my battery I am not that fussed as I will have plugged the power in. If you decide to fix this that's up to you.

