Simple low battery alert
Forum: DSL Ideas and Suggestions
Topic: Simple low battery alert
started by: WDef
Posted by WDef on April 10 2007,23:03Here's a simple low battery popup alert, saves that annoying feeling when the screen on my laptop suddenly goes black and anything in /home/dsl is lost.
If memory serves I wrote it this way because I found torsmo's battery monitoring in dsl didn't work properly on my friend's Sony Vaio VGN315S using dsl-2.1b.
I have a feeling lua can generate a system beep running from the background, if so that 'beep' line could be replaced with something in lua.
In ~/.torsmorc I have:
The above assumes it's being run on a single battery laptop, but a more complicated script could examine /proc/acpi/battery to list batteries and then report on each (i suppose)
Posted by Juanito on April 12 2007,08:30I tried out your script - in the original .torsmorc file there is already a line:
Do you mean to modify it to read as follows?
The battery has not run down to 20% yet so I could not verify this works...
Thanks for providing the motivation to look at the .torsmorc file, I added the following line immediately after the battery line to show the cpu temperature:
You could add to your script to call "exitcheck.sh shutdown" when the battery charge drops to 5% - This being said, on my machine the battery will last for at least 30 minutes when it shows less than 5 minutes life remaining
Is there any way to change "last full capacity"?
From Google, there are a number of good (and complex - for me at least) scripts to catch all manner of acpi events using acpid and act on them. For example, from the above, I believe your script could be called on "design capacity warning: 4200 mWh" being met and shutdown called on "design capacity low: 1272 mWh" being met.
In a similar manner, cpufreqd (in 2.6.x) is using acpi events to make decisions like:
If the battery capacity is > 75% then run then run the cpu at full speed no matter what
If 25% < battery capacity < 75% then increase the cpu speed on only on demand
If battery capacity < 25% then run the cpu at minimum speed no matter what.
I believe a whole DSL library of acpi/acpid actions could be built on battery, fan, lid, powerbutton, temp, etc events - food for scripting thought...
Posted by WDef on April 14 2007,22:20
I think last full capcity shows the battery's last maximum charge. Batteries degrade with use/abuse so this probably drops during the life of the battery, That's my guess anyway. Should be in a man/doc page somewhere.
Lot of interesting ideas in your post Juanito.