Friday, 22 June 2007

Power button event on gnome

On my Debian etch, I configured gnome-power-manager to ask me what to do when the power button is pressed. However, when I did, I could see the GPM prompt followed by the system immediately shutting down.

This is caused by the script /etc/acpi/, which, I believe, was written to work with KDE. I have changed mine to look like this:

# /etc/acpi/
# Initiates a shutdown when the power putton has been
# pressed.

# If powersaved is running, let it process the acpi event
if pidof powersaved; then
exit 0

# Commented-out the following line
#if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop

if ps -Af | grep -q 'gnome-power-manager'
# Commented-out the following line and added "exit 0"
# dcop --all-sessions --all-users ksmserver ksmserver logout 0 2 0 && exit 0

exit 0
/sbin/shutdown -h now "Power button pressed"
Quick-and-dirty, but it works. Maybe I should be running powersaved but I couldn't bother.

No comments: