I had a hemorrhage with acpi scripts, and on a laptop there are 2 users using a different set of programs, so I decided to write a simple script , which you need to edit for your device and put in the kde (or other environment) autoload. The script itself: #!/bin/bash acpi_listen>>/tmp/user_acpi& echo 0>/tmp/user_acpi while [ 1 -eq 1 ]; do sleep 1 temp=`tail -n 1 /tmp/user_acpi|awk '{ print $3 }'` echo 0>/tmp/user_acpi case "$temp" in 0000005c) # dbus-send --session --dest=org.freedesktop.ScreenSaver --type=method_call /ScreenSaver org.freedesktop.ScreenSaver.Lock ;; 00000095) # «» amarok ;; 00000051) # «» firefox ;; 00000082) # «» kamoso ;; esac done
To remake the script for yourself, you need to find out the key code and replace it in the script, or add something to your device. In order to find out the key code, enter acpi_listen | awk '{print $ 3}' and press the buttons, the necessary codes will be displayed on the screen.