X11 Laptop Battery Monitor for the n140 (and others)This is a small Perl scripted battery monitor that displays the battery state (chargind, discharging) using TK. It also tries to estimate remaining time in minutes until empty or full charge from the current capacity and change rate.
It may be useful for other laptops as well, I originally wrote it for my ThinkPad x31. Basically what you need to do is to check whether there is usefull information in
/proc/acpi/battery/BAT1/info /proc/acpi/battery/BAT1/stateAnd then adapt the script to parse it. The battery number may be different, on the x31 it was BAT0.
Source code is here: batt_mon
The charging state looks like this (75% charged, 115 minutes to full):
Discharging looks like this (75% charged, 306 minutes to empty):
Update rate is every 10 seconds. Can be changed in Line 37.
X11 IntegrationI use the following line in the InitFunction of my .fvwmrc, which places the display at the lower right side. Adapt for your window manager.
+ "I" Exec exp/perl/tk/batt_mon -geometry 140x20-172-0 &