Pages

Linux Mint 15 Suspend when power button is pressed

I wanted my Compaq 6820s to Suspend when the power button was pressed. Using the Power Management application I set the General tab options like this:


But the results were unreliable, something along the lines of:
Press Power -> Laptop Suspends
Press Power -> Laptop Resumes, briefly, then Shuts Down
Press Power -> Laptop boots

I looked at the /etc/acpi/powerbtn.sh

I don't know how this script works but the last two lines caught my eye:

# If all else failed, just initiate a plain shutdown.
/sbin/shutdown -h now "Power button pressed"


Which makes it quite difficult to catch problems. So I commented out the last line:

sudo pluma /etc/acpi/powerbtn.sh

# If all else failed, just initiate a plain shutdown.
#/sbin/shutdown -h now "Power button pressed"


And that was sufficient to give me the result I was looking for. Now the power button consistently follows the actions in the Power Management settings.