Up until now I had to manually run "acpi" once in a while to check my battery status and take necessary action, and this process was a real pain in the ass especially when you are watching a movie and don't want to be disturbed. Thats why i decided to cough up a little script that would keep monitoring my battery status and "tell me"(literally) when either battery is low or battery has been fully charged.
Prerequisites
- Festival text to speech system: Festival can read out text from stdout and hence is really handy. In Ubuntu/Debian-like systems you can run the following command to install festival.
sudo apt-get install festival
- A small problem with the default installation of festival is that festival by default uses the outdated /dev/dsp to access your sound hardware. Hence festival cant say anything if you are using another application that has sound like mplayer for instance. To fix this you need to get festival to use ALSA. To do that run the following command from terminal.
printf ";use ALSA\n(Parameter.set 'Audio_Method 'Audio_Command)\n(Parameter.set 'Audio_Command \"aplay -q -c 1 -t raw -f s16 -r \$SR \$FILE\")\n" > ~/.festivalrc
Now download the following file and extract its content(battmon.sh) into your home directory
http://sites.google.com/site/r4jivn4ir/Home/battmon.tar.gz
Make the script executable by running
chmod +x battmon.sh
Now you need to setup this script to run during login. To accomplish that add the following line to the end of the file .xprofile which is present in your home directory. If such a file is not present create it.
./battmoh.sh &
From the next time you login, this script will keep checking your battery status and "tell you" whether you need to charge your battery or unplug your charger. Do test and let me know if it works :-)
4 comments:
http://www.lesswatts.org/projects/powertop/ PowerTOP is a Linux tool that helps you find those programs that are misbehaving while your computer is idle.
So what are u on right now? XFCE..? Or just the good ol' terminal? ;)
Quite useful post ! Thanks :D
Quite useful! Thanks :D
Post a Comment