Multimedia Keys

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

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.

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.

showkey -k

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.

apt-get install xbindkeys

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 install xev use apt-get

sudo apt-get install xev

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 <mouse_id> and you can get the mouse id 'xinput --list'

related pages