5

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.

  • What versıon of Gnome are you running? 2.x or 3.x? – Caleb Jul 17 '11 at 6:53
  • @Caleb Gnome 2.30.2. – Elena Feb 4 '12 at 16:49
3

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.

  • I prefer sudo bash -c ' sleep 300; shutdown -h -t 5' so the shutdown by GUI is not denied for the user. – totti Jan 13 '14 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.