Shutdown Pressing Power Button

From ArchWiki
Revision as of 13:33, 6 August 2005 by Citral (Talk | contribs) (Added xfce4.2)

Jump to: navigation, search

If you want to shutdown your system by simply pressing the power button, do the following:

Install acpid package, add acpid to the DAEMONS array in rc.conf (and/or execute /etc/rc.d/acpid start) and create a file in /etc/acpi/events/ with following content:

# /etc/acpi/events/power
# This is called when the user presses the power button

event=button/power (PWR.||PBTN)

From now on pressing the power button (lightly, not for few seconds) should properly shutdown the system. However, if you're using more sophisticated WM, you should use its own shutdown call, so it'd save its session etc.

To accomplish it in KDE, simply change the action to:

/opt/kde/bin/dcop --all-users --all-sessions ksmserver ksmserver logout 0 2 0

Likewise for XFCE4.2 change the action line to:

echo POWEROFF | /opt/xfce4/libexec/xfsm-shutdown-helper