I'm a command line junkie and spend most of my time there. When I use X, I use fluxbox as my window manager because it's fast and lightweight. On my laptop, it's necessary to know what my battery status is for obvious reasons. I've tried using apps such as torsmo and gkrellm, but for me, they defeat my reason for using fluxbox. Since I spend most of my time in the command line, I decided to write a small script whose output would display my battery status directly in my shell prompt. Also, to make it easier to notice, I decided to colorize that part of my prompt, with a different color for different battery levels. You can find this script at http://swicked.net/djaimes/code/bat_mon.sh.To get this output each time my prompt appears, I added this to my $PS1 variable:
\[\$(/usr/local/bin/bat_mon.sh)\]
So, if your $PS1 was originally this:
\u@\h:\w\$
Then this is what it should look like now:
\[\$(/usr/local/bin/bat_mon.sh)\]\u@\h:\w\$
To make this change permanent, simply put this line in your .profile
export PS1="\[\$(/usr/local/bin/bat_mon.sh)\]\u@\h:\w\\$ "
Notice the extra backslash (\) before the last $ sign. I found this necessary in order for my prompt to change from $ to # when I did a simple su. Now, each time your prompt is displayed, you can easily see the status of your battery in various colors.
See also:
and how to use it is found here: http://swicked.net/pages/bat_mon.html
Thanks