Bind multimedia keys
Solution 1:
In short steps:
-
Find the keycode using e.g.
xev
. Just startxev
from a terminal and press the relevant button and note the key code, e.g.KeyPress event, serial 36, synthetic NO, window 0x2400001, root 0x15a, subw 0x0, time 1566086412, (15,210), root:(634,738), state 0x10, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False
when pressing scroll lock. Note
keycode 78
. If you already get the "human readable" name in following parenthesis such as "Scroll_Lock
" above, your keys already "work" as much as X recognizes them as distinct keys. If so, jump to 3. -
Add the key codes to
~/.Xmodmap
. Sample syntax:keycode 144 = XF86AudioPrev keycode 153 = XF86AudioNext keycode 176 = XF86AudioRaiseVolume keycode 174 = XF86AudioLowerVolume
-
This is window manager specific. You mentioned Xfce. From e.g. the Gentoo wiki for Xfce:
Go to Settings > Keyboard Settings, and select the "Shortcuts" tab. To define our own key bindings, we have to create a new theme. Click "Add" to create it (note that all key bindings from the default theme are copied into the new theme). In the "Command Shortcuts" section, doubleclick on an empty slot, enter the command you would like to bind and press the according key. The keysym from your .Xmodmap should appear next to the command if everything works as expected. Done.
All in all, the Gentoo wiki on multimedia keys seems to be good for more elaborate instructions.