ACPI/ThinkPad-special-buttons

Many modern computer keyboards contain special media keys or key combinations to control functions such as monitor brightness, keyboard backlight brightness, volume (sound) level, suspend (sleep mode), and more. Some special keys need additional configuration in order to control what they are intended to control. This additional configuration can be done through ACPI.

It is important to note that most users to not need ACPI to handle the buttons if using a major desktop environment; desktop environments like Gnome, KDE, and Xfce should be capable of handling special buttons. If the desktop environment has not detected special keys automatically, most of the time it can be configured to properly handle the special key events.

Preparation
To have a functional ACPI make sure the kernel includes support for. The zgrep command can be used to search through the file if .config support was built into the previous kernel:

On boot it might be necessary to append the  kernel command-line option. This is no a proper way to handle ACPI events, however it might be needed on some systems.

To check what names ACPI uses on a specific button, start acpi_listen and press +special key buttons to see the output from each key:

Collect the names printed in the file above. They will vary from system to system.

By default, system store key assignment can be found in the file:

By default some buttons are mapped to key codes that X can not handle or has no keysym for. So the following might be useful. It modifies the udev defaults slightly to fix the key combinations that otherwise would not work in X:

Recipes
Create an event for each button in, the following example names them by location-function; use whatever naming scheme works best. After creating the events create corresponding actions for each event in See examples below for more information.

Battery button
Be sure to make the action script executable:

Source: ThinkWiki.org

Brightness up
Remember to make the script executable:

Brightness down
Be sure to make the script executable:

Source: forums.gentoo.org

CD control
Instead of CD I would like to control.

Initially I start mocp manually to populate playlist, quit qui and than use special keys to control mocp.

Troubleshooting
To see output when a key is pressed:


 * bug report on bugzilla.kernel.org


 * bug report on bugs.freedesktop.org

Questions

 * Do I need to place all events in the same file, something like and make it downloadable?

Another option is to use ScrLk key to lock console with, or it can be done through the same acpi action? dunno
 * How to choose vlock vs slimlock screenlock action depending on console vs Xorg or for both altogether?