Debian – way to control the delay before shutdown on low battery

debiangnomelinuxshutdown

Is there any way to configure shutdown on critically low battery to give me a bit of time before actually shutting down?

I've set GNOME Power Manager to shutdown on low battery (hibernating does not work on my netbook). Problem is, I don't get any notification about battery running low, and as soon as battery level reaches the critical threshold, the system quickly kills applications and shuts down without me having any chance to quickly complete some tasks and/or save some data. Of course, I'd increase battery level thresholds to gain some more time to accomplish such tasks.

If some other window manager has a more advanced power management facility than GNOME, I'm also willing to switch.

Best Answer

I don't use it, but a few google searches and it looks like GNOME Power Manager isn't that configurable (i.e., there are reports that it doesn't allow any customization).

That being the case I'd recomend switching to something else (e.g, acpid, hal, devicekit-power, etc.) that is scriptable.

Find (or create) the script that runs on the low battery event and use zenity to give yourself a warning, schedule a shutdown.

zenity --warning --title "Battery" --text "Low battery. (state = $state)" &
shutdown -h -t 300

The 300 gives you 5 minutes (customize this for your needs).

There will also be an "ac" event, when you plug into AC power. You'll want this event to cancel any pending shutdown.

shutdown -c

Sorry it's not a complete solution, but there are many ways to do this.

Related Question