Labels

Thursday, 1 July 2010

Ubuntu (10.04) custom power button event

Update 14. Oct. 2010: Works in Ubuntu 10.10 as well.

To poweroff only if the power button is pressed twice - change /etc/acpi/powerbtn.sh like this:

#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.
# you need to double 'click' the power button to shutdown
( if ! [ $(pidof -x powerbtn.sh | wc -w) -eq 3 ]; then
        sleep .4
        exit
else
        poweroff
fi) &


It won't ask silly questions either - just shutdown now.
Now remove the wire from the reset button to make it more kid proof.

No comments:

Post a Comment