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.