Poor Man's Low Power Alarm - beeps when laptop power is low
This project is maintained by ckhung
Poor Man's Low Power Alarm is a tiny perl script to alarm you when the laptop power is low. I wrote it because on my old computers I run antix, whose window manager icewm does not seem to have an auditory low power alarm program.
Pmlp-alarm makes use of beeptune so please make sure that (1) you have installed the beep package (either rpm or deb) and (2) you have unmuted the beep channel using alsamixer. However, you don't need to download my beeptune package because a copy of the bare beeptune script (without documents and examples) is included in pmlp-alarm. Once these are taken care of, you need to:
pmlp-alarm and beeptune
to /usr/bin
TaskBarShowAPMStatus=1 in ~/.icewm/preferences
and restarting icewm.
pmlp-alarm -v 2 on the command line,
watch its output, and wait for the battery to run into low power.
By default, pmlp-alarm starts beeping when the batter drops below 30%,
and beeps more urgently when it drops below 10% and even more so below 5%.
pmlp-alarm to /etc/rc.local
You don't need -v 2 since you can't see the message anyway.
The -v option controls verbosity.
You can use -v 1 to make pmlp-alarm
print more information, and -v 2
to make it print even more messages.
You can specify the time interval (in seconds)
between battery level checks when the battery power is relatively high
using the -s option.
For example -s 900 means checking the
battery power level every 15 minutes.
The more complex option -l defines
a list of power level specifications separated by spaces.
A power level specification is of the form
mm%nns
{cmd}, which asks
pmlp-alarm to change checking interval to
every nn seconds
and execute the alarm command cmd
once the power level drops below mm%.
For example, the power level specification
30%180s {beep -f 800 -l 200}
asks pmlp-alarm to check the power level and run the alarm
command beep -f 800 -l 200 every 3 minutes
once the power level drops below 30%.
Other possible auditory alarm commands include mpg321,
playmidi, and beeptune.
Each of these commands requires a song file as an argument.
Be sure to give full path names.
If you are using beeptune as the alarm command,
The good news is that pmlp-alarm provides three builtin tunes
so that you don't need any separate song file.
You reference them in the alarm command as
#warn, #serious, and #urgent,
respectively. So for example,
30%180s {beeptune #warn}
asks pmlp-alarm to check the power level and play the #warn
builtin beep tune every 3 minutes once the power level drops below 30%.
The default behavior of pmlp-alarm is as if
the following option is given on the command line:
-l '30%180s {beeptune #warn} 10%60s {beeptune #serious} 5%20s
{beeptune #urgent}'
You can also change the builtin tunes or add more builtin tunes.
Please see the $builtin_tunes variable
initialization at the end of the script as well as
the documentation for beeptune (for the .tune file format) for more details.