Today, a lot of keyboards have additional keys. Here, we show how to use them. This article is based on part of the very good Léa Linux How-To.
By default, KDE has bindings for every common multimedia key to have them work as expected. These are exposed to the users and can be further changed and configured from your settings in a such a way that they'll persist after reboot without the need to touch a terminal. It's a very powerful and very simple feature!
Open Application Launcher > Search > Global Shortcuts
Open Application Launcher > System Settings > Shortcuts > Global Shortcuts
- Select the relevant category in the "System Services" section
- Select the action you wish to configure, where you can then disable the default shortcut and/or add a custom shortcut.
You can also simply configure your multimedia keys to do a wide array of different actions by first disabling the default global shortcuts that the keys are bound to (as explained above), and then instead binding them to custom shortcuts.
These can be set to trigger regular commands, D-Bus commands, or to automatically type some specified keyboard input.
Open Application Launcher > Search > Custom Shortcuts
Open Application Launcher > System Settings > Shortcuts > Custom Shortcuts
- Click the "Edit" button at the bottom and create a new group
- Enable the group by clicking the checkbox next to its name
With the new group selected, click Edit > New > Global Shortcut, and choose your desired action category
- With the new action created and selected, in its "Trigger" tab, click on the "Shortcut" button and press the multimedia key. KDE will inform you if another shortcut is currently bound to that key. In the "Action" tab, configure the action to be executed on press to your liking.
- Open a terminal
Run xev (xbase-clients)
Search "keycode". In this example, it's 160
KeyPress event, serial 28, synthetic NO, window 0x2800001, root 0x5c, subw 0x0, time 3864774064, (-249,385), root:(429,410), state 0x0, keycode 160 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False
Try and note down all multimedia keys.
- Go to a console, e.g. with Ctrl-Alt-F1
run showkey for keycodes or mev for mouse events
Here, we're going to use xmodmap to modify keymaps and insert our multimedia keys.
Create a new text file: ~/.xmodmaprc
- The file uses this syntax:
keycode YOUR_KEYCODE = YOUR_NAME
Choose a name in /usr/share/X11/XKeysymDB.
- For example:
keycode 160 = XF86AudioMute keycode 174 = XF86AudioLowerVolume keycode 176 = XF86AudioRaiseVolume keycode 162 = XF86AudioPlay keycode 144 = XF86AudioPrev keycode 145 = XF86AudioNext keycode 164 = XF86AudioStop keycode 237 = XF86HomePage
- To apply that, run:
Autostart for every WM
To load your changes at startup, add this to your ~/.xsessionrc :