Ubuntu – Low-battery-power action without gnome-power-manager

batteryhibernatelaptoppower-managementsuspend

I'm running the openbox WM and would like to avoid loading the gnome stack. One of the lingering issues I have to resolve is avoiding abrupt system crashes due to depleted battery power.

Is there a low-profile, low-dependency daemon that will handle this situation? I'd like to be able to configure it to, for example, drop the system down into hibernation at 4% battery life if the AC is not connected.

I suppose I could just write a little cron job to poll /sys/.../batt*/.. and /sys/.../ac*/... every 10 minutes or so, but it seems like there might be some edge cases that need tending.

update

laptop-mode-tools sounds promising:

It … supports various … power management features, such as … automatically hibernating if battery levels are too low…

However, it doesn't seem to be possible to install it in Maverick without relatively dire consequences.

On my system, its installation also requires the removal of the acpi-support package, which sounds sort of ominous.

Best Answer

You are very probably already running it: acpid. If the GNOME or KDE stuff is already installed then you'll find a bunch of ACPI event handlers already in /etc/acpi/events and scripts run in response to those events in /etc/acpi itself; you can modify or replace those scripts with your own handlers.

Unfortunately, there doesn't appear to be a lot of documentation included with Ubuntu about what events are available, and the handlers I see provided with acpid and acpi-support don't appear to include anything that tracks the battery level. Since ACPI should be providing events for that, you may have to experiment with /usr/share/doc/acpid/examples/default* to see what events are actually delivered so you can write handlers for them.

Related Question