If you are working on an ACPI system you can customize the behaviour of your ACPI
buttons.
These are:
Search for the button event configuration variables in
/etc/powersave/events
(also see Events).
You may also be able to catch other (multimedia) buttons that are ACPI driven. However, this mainly depends on your system. If your system provides ACPI driven buttons you can use one of the provided scripts or implement your own (see Scripts).