After reading through Ubuntu's acpi setup, it seems like the issue is that when the login manager is running, there is no suitable handler running. So, according to the nicely-commented /etc/acpi/powerbtn.sh
, it defaults to just shutting down the computer. You'd like to change this behavior? I think you just need to remove the final line of powerbtn.sh
:
/sbin/shutdown -h now "Power button pressed"
and insert
/usr/sbin/pm-hibernate
above the handlers for X power management daemons (the three lines of comments), like this:
...
test -f /var/lock/acpisleep && exit 0
-> pm-hibernate
# If the current X console user is running a power management daemon that
...
and ACPI will invoke hibernation instead using your DE's power handling. Note that this change will affect all ttys, not just the X tty. That is, the power button will hibernate the computer when you're in tty1. If you're like most Ubuntu users, this isn't a deal breaker, because most people (myself included) spend 99% of their time in X.
resume=/dev/sda4
to my kernel parameters in/etc/default/grub
. (sda4
is my swap partition.) – thirtythreeforty Oct 27 '12 at 17:55/usr/sbin/pm-hibernate
line in the middle of the script, before the test for gnome-settings-manager etc. Of course, this is a hack since it bypasses gnome altogether. But it works! – Adam Paetznick Oct 27 '12 at 19:58pm-hibernate
, dodbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
. A little messier, but GNOME will lock. I don't know whether lightdm has a power management program running, although the point of Dbus is that if something isn't running, it will be started to handle the request. Give it a shot and let me know! – thirtythreeforty Oct 27 '12 at 20:39