Change the default action of the power button in KDE 3/Kubuntu.

Written by David Banham

When Gutsy came out recently I decided to make the switch from Gnome to KDE. Overall I like it, but there are some things that are driving me nuts. One of them is that there seems to be no way to change the default action of the power button on my laptop. This was easy to change in Gnome, but requires more trickery in KDE.

After a while of searching around in control panels and on Google, it became apparent that the answer I sought did not lay in a GUI. Thankfully, the acpi config files are very easy to edit.

All you need to do is go to /etc/acpi/events and find the file named powerbtn. It's good practice to make a backup at this point. Copy the file to something like powerbtn.bak. Now click the handy "edit as root" button in Dolphin.

Alternately, if you're comfortable in a terminal, it's much simpler to just issue the following command: > sudo cp /etc/acpi/events/powerbtn /etc/acpi/events/powerbtn.bak && sudo kate /etc/acpi/events/powerbtn Once in there, find the line action=/etc/acpi/ and change it to the following: > action=/etc/acpi/ Save it and you're done. You'll need to restard acpid (or just reboot the whole os) before the change will take effect.

What this change does is, instead of telling the system to run the "ask the user what they want to do" script when the power button is pressed, it tells the system to run the "hibernate now" script when the button is pressed.