- Multimedia Keys
- Contents
- Media Keys Under Linux
- Ubuntu
- Kubuntu
- MythTV
- other tools and examples
- related pages
- Extra keyboard keys
- Laptops
- Apple MacBooks
- Asus M series
- Asus N56VJ (or possibly others)
- Lenovo T460p (or possibly others)
- Gaming Keyboards
- Cooler Master CM Storm QuickFire TK
- Corsair K series keyboards
- Logitech G series G710 and 710+
- Logitech G613
- Logitech MX
- Non-standard keyboards
- Royal Kludge RK61 and possibly other Apple keyboards
- See also
- Desktop Usage
- Custom Shortcuts
- Under Gnome
- Command-line
- Identifying keys
- Key naming
- Autostart for every WM
- Multimedia Keys
- Contents
- Media Keys Under Linux
- Ubuntu
- Kubuntu
- MythTV
- other tools and examples
- related pages
Multimedia Keys
Many keyboards include some special keys (also called hotkeys or multimedia keys), which are supposed to execute an application. These keys are known by some different terms such as Multimedia Internet Keyboard Buttons. These keyboards have special keys used to access the Internet, music, and other frequently used programs such as email. A typical example contains buttons that control various computer processes, such as turning on the computer’s power, putting the CPU to sleep, and waking it up again.
Multimedia keyboards designed for use with Microsoft Windows typically come already programmed, ready to use right out of the box.
Contents
Media Keys Under Linux
Some common multimedia key examples with common scancodes
172 Play / Pause 174 Stop 056 Back (Rewind) 041 Forward 173 Last track 171 Next track 121 Mute 122 Volume up 123 Volume down
Scancode may vary from keyboard manufacturer. Other keys can be mapped using xev.
Ubuntu
In Ubuntu 5.10 (Breezy Badger), Ubuntu 5.04 (Hoary Hedgehog) and later Ubuntu versions, please go to System menu -> Preferences -> Keyboard Shortcuts to find the keyboard shortcut editor. For Kubuntu, see KDEMultimediaKeys. For Xubuntu, see XfceMultimediaKeys.
GNOME directly queries X11 for its media keys support, so you don’t need to manually configure it. However, Xfce doesn’t, and you’ll have to manually get the keycodes and set the symlinks.
detect keys from the multimedia keyboard
Another alternative: Xbindkeys is a program that allows you to launch shell commands with your keyboard or your mouse under X Window. It links commands to keys or mouse buttons, using its configuration file. It does not depend on the window manager and can capture all keyboard keys.
Kubuntu
The volume up and volume down are intercepted. They display a screen overlay with vol up and down position. The scancode IS reported by xev as a KeyRelease event but not as a KeymapNotify event.
MythTV
To get multimedia keyboards or remotes with media keys to work in MythTV you first have to get them recognized with Xfce under Linux.
For a guide on MythTV / Mythbuntu, hotkeys, and key mapping see: Multimedia Key Mapping in Mythbuntu
Other comments from various sources:
«. disabling «Launch Gnome Services at Startup» on the Startup Settings-Advanced Page within Mythbuntu. Now play generates keypress events. I was surprised that disabling xfce4-volumed wasn’t enough, but at least its resolved.»
«. mythcontrols is a simple plugin that allows you to edit all of your keybindings.»
«you should just use xfce keyboard settings (on xfce4-settings-manager) to customise your keymap choices. [. ] xfce4’s DE/WM should take care of any reason for having to customise .Xmodmap, generally speaking. [. ] DE/WM are Desktop-Environment (XFCE4) / Window-Manager (xfwm4), is an example. «
other tools and examples
- xev
- ‘xev -event keyboard’
- evtest
- ‘xinput test-xi2 —root’
- ‘xinput list’ and followed by the number of the device ‘xinput test 14’
- /usr/lib/ncurses/examples/demo_altkeys
- screenkey
- ‘showkey -a’ works in console only but wont show mouse clicks. You will have to kill from another console to get out
- ‘sudo showkey -s’ shows scancodes, self terminates in 10 seconds.
- xinput —query-state and you can get the mouse id ‘xinput —list’
related pages
Extra keyboard keys
This article assumes you have read Keyboard input.
Many keyboards include some special keys (also called hotkeys or multimedia keys), which are supposed to execute an application or print special characters (not included in the standard national keymaps). udev contains a large database of mappings specific to individual keyboards, so common keyboards usually work out of the box. If you have very recent or uncommon piece of hardware, you may need to adjust the mapping manually.
Laptops
Apple MacBooks
All the required information is available on the Apple Keyboard dedicated article.
Asus M series
In order to have control over the light sensor and the multimedia keys on your Asus machine, you should use the following command:
# echo 1 > /sys/devices/platform/asus_laptop/ls_switch
To have it run on boot create a Systemd tmpfile:
w /sys/devices/platform/asus_laptop/ls_switch - - - - 1
Asus N56VJ (or possibly others)
If most of your special keys do not work, try loading the asus-nb-wmi kernel module with
then check xev again. If you combine this with the acpi_osi=»!Windows 2012″ boot option, you may get weird results in xev, so try not using it. If this did fix things, make sure to make the module load at boot with methods described in Kernel modules#Automatic module loading.
Lenovo T460p (or possibly others)
Out of the box, the backlight keys (on F5 , F6 ) might not be available, even via the /dev/input interface. To fix this, follow Backlight#Kernel command-line options.
Gaming Keyboards
Gaming keyboards have some special features which may cause them to «misbehave» in Linux.
Cooler Master CM Storm QuickFire TK
This keyboard has two features that could cause confusion in Linux: N-Key Rollover and the Win-Lock Key.
N-Key Rollover can cause problems with the Function keys. To disable N-key rollover, hold down the FN lock key (next to right-ctrl) until it lights up, then hold Escape and press 6 to switch to 6-key rollover. Hold down the FN lock key to disable the Fn lock.
The Win-Lock Key completely disables the Super (Windows) keys. Simply press the FN lock key and F12 together to toggle Win-Lock on and off.
Corsair K series keyboards
There is a winlock button on these keyboards that can disable the use of the Super (Windows) keys. This button is located at the top right of the keyboard next to the num and capslock buttons. CKB can be used to disable this functionality entirely preventing further locking. However, in a default state, simply pressing the button would enable the Super (Windows) keys again.
Logitech G series G710 and 710+
This keyboard has a row of 6 programmable G keys. In order to use them as intended by Logitech, you need to install sidewinderd AUR and start sidewinderd.service .
Logitech G613
This keyboard has a row of 6 programmable G keys. In order to use them as intended by Logitech, you need to install solaar . Within solaar, you will be able to divert the G-Key functions and remap them.
Logitech MX
These keyboards have special keys such as Snipping Tool, Mic Mute that does not produce key codes. Using solaar , you can divert these keys and remap them.
Non-standard keyboards
Royal Kludge RK61 and possibly other Apple keyboards
Some Apple keyboards (including the Royal Kludge RK61) have the function F1 – F12 keys defaulted to mac media keys. If no Fn Lock is available, this is the the only available behavior unless the default Apple Keyboard behavior is changed. In order to remedy this, make sure the keyboard is being identified as an Apple keyboard using the following command:
# lsusb | grep "Apple.*Keyboard"
Proceed to Apple Keyboard#Function keys do not work if an Apple Keyboard is found.
See also
Desktop Usage
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 Shortcutsor
- 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.
Custom Shortcuts
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.
- Open Application Launcher > Search > Custom Shortcutsor
- 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.
Under Gnome
Command-line
Identifying keys
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.
Key naming
keycode YOUR_KEYCODE = YOUR_NAME
keycode 160 = XF86AudioMute keycode 174 = XF86AudioLowerVolume keycode 176 = XF86AudioRaiseVolume keycode 162 = XF86AudioPlay keycode 144 = XF86AudioPrev keycode 145 = XF86AudioNext keycode 164 = XF86AudioStop keycode 237 = XF86HomePage
Autostart for every WM
To load your changes at startup, add this to your ~/.xsessionrc :
Multimedia Keys
Many keyboards include some special keys (also called hotkeys or multimedia keys), which are supposed to execute an application. These keys are known by some different terms such as Multimedia Internet Keyboard Buttons. These keyboards have special keys used to access the Internet, music, and other frequently used programs such as email. A typical example contains buttons that control various computer processes, such as turning on the computer’s power, putting the CPU to sleep, and waking it up again.
Multimedia keyboards designed for use with Microsoft Windows typically come already programmed, ready to use right out of the box.
Contents
Media Keys Under Linux
Some common multimedia key examples with common scancodes
172 Play / Pause 174 Stop 056 Back (Rewind) 041 Forward 173 Last track 171 Next track 121 Mute 122 Volume up 123 Volume down
Scancode may vary from keyboard manufacturer. Other keys can be mapped using xev.
Ubuntu
In Ubuntu 5.10 (Breezy Badger), Ubuntu 5.04 (Hoary Hedgehog) and later Ubuntu versions, please go to System menu -> Preferences -> Keyboard Shortcuts to find the keyboard shortcut editor. For Kubuntu, see KDEMultimediaKeys. For Xubuntu, see XfceMultimediaKeys.
GNOME directly queries X11 for its media keys support, so you don’t need to manually configure it. However, Xfce doesn’t, and you’ll have to manually get the keycodes and set the symlinks.
detect keys from the multimedia keyboard
Another alternative: Xbindkeys is a program that allows you to launch shell commands with your keyboard or your mouse under X Window. It links commands to keys or mouse buttons, using its configuration file. It does not depend on the window manager and can capture all keyboard keys.
Kubuntu
The volume up and volume down are intercepted. They display a screen overlay with vol up and down position. The scancode IS reported by xev as a KeyRelease event but not as a KeymapNotify event.
MythTV
To get multimedia keyboards or remotes with media keys to work in MythTV you first have to get them recognized with Xfce under Linux.
For a guide on MythTV / Mythbuntu, hotkeys, and key mapping see: Multimedia Key Mapping in Mythbuntu
Other comments from various sources:
«. disabling «Launch Gnome Services at Startup» on the Startup Settings-Advanced Page within Mythbuntu. Now play generates keypress events. I was surprised that disabling xfce4-volumed wasn’t enough, but at least its resolved.»
«. mythcontrols is a simple plugin that allows you to edit all of your keybindings.»
«you should just use xfce keyboard settings (on xfce4-settings-manager) to customise your keymap choices. [. ] xfce4’s DE/WM should take care of any reason for having to customise .Xmodmap, generally speaking. [. ] DE/WM are Desktop-Environment (XFCE4) / Window-Manager (xfwm4), is an example. «
other tools and examples
- xev
- ‘xev -event keyboard’
- evtest
- ‘xinput test-xi2 —root’
- ‘xinput list’ and followed by the number of the device ‘xinput test 14’
- /usr/lib/ncurses/examples/demo_altkeys
- screenkey
- ‘showkey -a’ works in console only but wont show mouse clicks. You will have to kill from another console to get out
- ‘sudo showkey -s’ shows scancodes, self terminates in 10 seconds.
- xinput —query-state and you can get the mouse id ‘xinput —list’