Gentoo Wiki ArchivesGentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc



Most modern keyboards are equipped with a number of multimedia keys. This simple HOWTO explains what you have to do in order to use these keys.

Determine the keycodes

Whenever you hit a key on your keyboard the kernel generates a raw scancode, which can be mapped to a keycode. X does this slightly differently and reads the kernel keycode table at startup, then maps the keycode to its own keycode table. Each keycode can be mapped to a keysym, which is a string that represents a key.

There are several applications that show the keycodes


Install the xev program:

emerge -av x11-apps/xev

and run it in an X terminal.

Press the multimedia keys on your keyboard and note the generated keycodes. The output of xev will look similar to this:

Code: Output of xev
KeyRelease event, serial 31, synthetic NO, window 0x2800001,
root 0x7d, subw 0x0, time 2792224, (-22,86), root:(565,101),
state 0x10, keycode 160, same_screen YES,
XLookupString gives 0 bytes:

The "keycode" value is what we are concerned with. In this example it is "160." Make note of each keycode value in respect to each extended key.

The following script can help you find the keycodes in the output of xev:

Code: xev and filter to run on its output
xev | sed -n 's/^.*keycode *\([0-9]\+\).*$/keycode \1 = /p' | uniq

Run this instead of plain xev. Press all multimedia keys in order, then close the xev window. The filtered output appears only after closing the window, for example:

keycode 36 =
keycode 144 =
keycode 162 =
keycode 164 =

Most likely, like in this example, you will have a first line in the output which is NOT a multimedia key. Simply delete it.

A single key can be identified without ending xev by:

xev | sed -n 's/^.*keycode *\([0-9]\+\).*$/keycode \1 = /p'

If pressing each key produces output from xev then you can jump ahead to Setting up xmodmap. If pressing a key doesn't do anything at all (ie, xev produces no output), you will need to find the raw scan code.


You can also switch to console and run

showkey -s

to see the scan codes, or

showkey -k

to see the key codes.

Note: One can switch to a console with the key-sequence Ctrl-Alt-[F1]. Switching between consoles is done with Alt-[F<terminal number>]. X usually runs on terminal seven or eight, so Alt-[F7] or Alt-[F8] return the user to X.

Using KeyTouch

KeyTouch provides an all-in-one solution for multimedia keyboards.

Code: Emerging keytouch
emerge -av keytouch

Start it under X and select the keyboard you have. After that, you can use it to connect functions or programs to your special keys. As far as I understood, you don't need a xmodmap.

If your keyboard is not in the list, emerge keytouch-editor (which is masked by keyword at the time of this writing).

Code: Emerging keytouch
echo "x11-misc/keytouch-editor" >> /etc/portage/package.keywords
emerge -av keytouch-editor

The official manual is available at Basically you just hit key by key and assign a name. Don't forget to send the file to the keytouch project (you will be asked for that when saving the file) to help others. It works like a charm and helped me overcome the keyboard.c: can't emulate rawmode for keycode XXX in the dmesg output when using the xmodmap method.


Another simple way to bring your multimedia keys to life is to use "lineakd". Lineak is available via portage (see for details).

Multiple application control

If you like to control more than one application you will need a command wrapper like ReMoot. ReMoot can control audacious, Rhythmbox, Amarok, Quod Libet, xine, kaffeine and some more. The command 'remoote play' will control the active application multimedia application and therefor you don't have to asign one key to one application. This is very useful toghter with LinEAK or Keytouch

Finding raw scan codes - PS/2 keyboards

If the above methods didn't recognise your keys and your keyboard is connected via the PS/2 connector (not USB), run the following command in an X terminal:

dmesg | tail

If you are using a PS/2 keyboard, you will probably see some lines like these:

Code: Output of dmesg
atkbd.c: Unknown key released (translated set 2, code 0x96 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e016 <keycode>' to make it known.

This means that the kernel doesn't have keycodes mapped to your keyboard's scancodes.

Mapping raw scan codes to key codes

You will have to add one line in /etc/conf.d/local.start for each missing key as follows:

File: /etc/conf.d/local.start
setkeycodes e008 136
setkeycodes e016 150
... And so on ...

Where the first number (e008) is the raw scan code (what you see in dmesg, or get from getkeycodes) and the second number (136) is an unused keycode in your kernel. In general you can find a good keycode by taking the last 2 digits of this first number, converting it from hex (base-16) to decimal (base-10) and adding 128.

Here is a simple bash script that can do the conversion for you. Just press all of your multimedia keys and run this script afterwards. It will parse the output of dmesg for unknown keys and give you the lines you should add to /etc/conf.d/local.start.

grep setkeycodes

This will set up the proper scancode - keycode mapping every boot. To set them up without rebooting, run the following as root:

sh /etc/conf.d/local.start

After you have the proper mappings setup, restart X and try running xev again, to ensure that a keycode is displayed for each multimedia key you want to use.

Finding raw scan codes - USB keyboards

atkbd.c is not used for USB keyboards, and if your kernel is configured to use full HID support you will not see any kernel messages. Instead you will need to run a user-mode program called getscancodes to read the key codes from one of the /dev/input/eventX devices, as described here.

For example by this method it is possible to find out that the codes for the zoom slider on a Microsoft Natural Ergonomic Keyboard 4000 are 0x1a2 and 0x1a3.

TODO: describe what to do with these codes

Setting up xmodmap

Once all the multimedia keys are being recognised by xev, they need to be mapped to keysyms. Create a file called .Xmodmap in your $HOME directory.

File: ~/.Xmodmap Example
! This works with Trust Silverline Direct Access keyboard
! The second stanza works for Dell Inspiron e1405 and e1505 laptops, as well as other standard keyboards (including the Logitech G15, and the Dell sk-8135 keyboard.)
! Use ! for comments

keycode 222 = XF86PowerOff
keycode 223 = XF86Sleep
keycode 236 = XF86Mail
keycode 229 = XF86Search
keycode 230 = XF86Favorites
keycode 178 = XF86WWW

keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 160 = XF86AudioMute
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume

A list of possible keysyms can be found in /usr/share/X11/XKeysymDB (on Gentoo), /usr/lib/X11/XKeysymDB or /usr/share/X11/XKeysymDB (the location of XKeysymDB may differ across distributions). The following is a list of the more commonly used keysyms as found in XKeysymDB.

File: /usr/share/X11/XKeysymDB
XF86ModeLock            :1008FF01
XF86Standby             :1008FF10
XF86AudioLowerVolume    :1008FF11
XF86AudioMute           :1008FF12
XF86AudioRaiseVolume    :1008FF13
XF86AudioPlay           :1008FF14
XF86AudioStop           :1008FF15
XF86AudioPrev           :1008FF16
XF86AudioNext           :1008FF17


XF86HomePage            :1008FF18
XF86Mail                :1008FF19
XF86Start               :1008FF1A
XF86SplitScreen         :1008FF7D
XF86Support             :1008FF7E
XF86Away                :1008FF8D
XF86Messenger           :1008FF8E
XF86WebCam              :1008FF8F
XF86MailForward         :1008FF90
XF86Pictures            :1008FF91
XF86Music               :1008FF92

All you have to do now is to call xmodmap whenever your X session starts, if this doesn't already happen automatically (it should.) Usually a good place to do this is your $HOME/.xsession file.

File: $HOME/.xsession
/usr/bin/xmodmap $HOME/.Xmodmap

Alternatively, you can set this up in ~/.xinitrc this way:

File: $HOME/.xinitrc
exec /usr/bin/xmodmap ${HOME}/.Xmodmap &

Remember to substitute $HOME for the full path for your home directory.

GDM setup
If you are using GDM you can use the file /etc/X11/Xmodmap as a system wide Xmodmap. You can also change the location to another Xmodmap file if you wish. Simply change sysmodmap=/etc/X11/Xmodmap in the file /etc/X11/gdm/Init/Default to whatever you would like.

KDM setup
Under KDM&KDE, the proper place to load ~/.Xmodmap file is ~/.kde/share/config/kdm/Xsession.

File: $HOME/.kde/share/config/kdm/Xsession
if [ -f $HOME/.Xmodmap ]; then
    /usr/bin/xmodmap $HOME/.Xmodmap

Do not forget to run "chmod +x ~/.kde/share/config/kdm/Xsession"

xfce4 setup
If you are using xfce4-sessions, then you just need to place the .Xmodmap file to ${HOME}/.Xmodmap.

Disabling auto-repeat

You may find that your keyboard has autorepeat enabled for the multimedia keys, which has the undesirable effect of the "next track" button sometimes skipping ahead by too many songs or the "play/pause" button pausing and then resuming immediately, if you accidentally hold the button down for a fraction too long.

Rather than altering your whole keyboard's auto-repeat timing to fix this, you can disable auto-repeat completely for specific keys (or enable it, if you have buttons to control the volume and you'd like to be able to hold these down instead of pressing them repeatedly to adjust the volume.) This can be done by running the xset command at startup (see above for the best place to put the commands, here ~/.xinitrc is being used.)

File: ~/.xinitrc
# Disable autorepeat for multimedia keys (except the volume controls)
xset -r 162 -r 164 -r 160 -r 144 -r 153

# The keycodes are the same ones supplied to xmodmap above

# Use "r" instead of "-r" to enable autorepeat instead if
# the keyboard doesn't natively repeat the key.

Assigning keys to special functions

Now that your multimedia keys have a keysym mapping, you can bind them to whatever function you want or your window manager allows you to. Note that some programs natively support hotkeys (especially media players) so it is more efficient (and lower latency) to use this mechanism where possible, as it doesn't rely on some other program executing a command to perform the action (see below for a list of known programs with built in hotkey support.)

Native hotkey support

These programs support hotkeys without window manager help, so they're much more responsive as a command doesn't have to be launched every time a key is pressed.


Since Audacious version 1.4 the hotkey plugin is available in the package audacious-plugins. To use the plugin go to the Audacious preferences, under Plugins, General, enable the Global Hotkey plugin and configure it by selecting the different commands and pressing the appropriate key.

Window manager hotkey support

Non window manager specific - xbindkeys

If your window manager doesn't have a facility for keyboard shortcuts, or indeed if you want to switch between multiple window managers/desktop environments and keep the same keyboard shortcuts throughout, then xbindkeys may be the solution for you.

To install, a simple emerge xbindkeys will do the trick.

After installation you must edit the config file ~/.xbindkeysrc. If you don't have the file (you won't), you'll get it by running xbindkeys and reading). The file is well commented with examples, but for completeness I will give an example here. To use the key XF86WWW to open your webbrowser (Firefox in this case), place the following code snippet into the config file:

File: ~/.xbindkeysrc
#General format being:
"command to execute"
key combination

You can use various modifiers (alt, shift, ctrl) to add additional shortcuts. For example, to launch a urxvt terminal with the key combination Ctrl-n, place the following code snippet in your config file:

File: ~/.xbindkeysrc
Control + n

When finished with your config file, simply run the command xbindkeys (or 'xbindkeys -n' if you do not want xbindkeys to run as a daemon).

If you are running xbindkeys as a daemon and edit .xbindkeysrc, it will automatically update bindings so you won't have to restart it.


You will need to emerge bbkeys. Once bbkeys is installed, make sure bbkeys is ran whenever you start X. Example xinitrc:

File: ~/.xinitrc
bbkeys &
exec blackbox

Now you will need to configure bbkeys. You can either use the global configuration file (usually /usr/share/bbkeys/bbkeysrc) or copy it to ~/.bbkeysrc and edit that instead. You can start from scratch but I recommend just adding to the already existing (and quite nice) defaults. Example:

File: ~/.bbkeysrc
[begin] (bbkeys configuration file)
 [keybindings] (begin keybindings)
 [Execute]   (XF86Mail)      {thunderbird}
 [Execute]   (XF86AudioPlay) {xmms --play-pause}
 [Execute]   (XF86AudioStop) {xmms --stop}
 [Execute]   (XF86AudioNext) {xmms --fwd}
 [Execute]   (XF86AudioPrev) {xmms --rew}
 [Execute]   (XF86AudioLowerVolume)  {amixer -q set PCM 2- unmute}
 [Execute]   (XF86AudioRaiseVolume)  {amixer -q set PCM 2+ unmute}
 [end] (end keybindings)
[end] (end bbkeys configuration)

That's all there is to it.


Open up your ~/.fluxbox/keys with your favourite editor. To control for example the basic XMMS functionality you append my example to your file:

File: ~/.fluxbox/keys
None XF86AudioPlay :ExecCommand /usr/bin/xmms --play-pause
None XF86AudioStop :ExecCommand /usr/bin/xmms --stop
None XF86AudioPrev :ExecCommand /usr/bin/xmms --rew
None XF86AudioNext :ExecCommand /usr/bin/xmms --fwd
None XF86AudioLowerVolume :ExecCommand amixer -q set PCM 5%- unmute
None XF86AudioMute :ExecCommand amixer -q set Master toggle
None XF86AudioRaiseVolume :ExecCommand amixer -q set PCM 5%+ unmute

For certain cards it might work if for mute you put PCM, instead of Master. It might give designed effect (volume up button when pressed will unmute the card):

File: ~/.fluxbox/keys
None XF86AudioMute :ExecCommand amixer -q set PCM toggle


Open your ~/.config/openbox/rc.xml file, search for section keyboard and, following the examples add in the end of session:

File: ~/.config/openbox/rc.xml
<keybind key="XF86AudioPlay">
 <action name="Execute"><execute>/usr/bin/xmms --play-pause</execute></action>
<keybind key="XF86AudioStop">
 <action name="Execute"><execute>/usr/bin/xmms --stop</execute></action>

For more information see documentation of openbox about keybind in

See about actions in the same page also.


Note: In xfce > (SVN) the shortcut settings are under Settings > Keyboard Settings

Open the Settings Manager, click on "Window Manager" and select the "Keyboard" 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.


With KDE you can set almost all settings through the Control Center if you have a supported keyboard. Go to Control Center -> Regional & Accessibility -> Keyboard Layout and choose your Keyboard model (I have a Logitech iTouch).

If Keyboard Layout is missing:

$ emerge -av kde-base/kxkb

After you have set your model, use KHotKeys to map the keys to actions. I usually use simple DCOP calls to talk to Amarok.

If your keyboard is not supported you can try the following:

If you use kdm as your login manager, kdm will source the file ~/.xprofile on each login.

Note: If you use Debian, your Xsession file will be located in /etc/kde[version]/kdm/ (substitute [version] with your KDE version)

Simply create the file ~/.Xmodmap as mentioned above, then have a line in ~/.xprofile that has xmodmap use it.

File: ~/.xprofile
/usr/bin/xmodmap $HOME/.Xmodmap

If this does not work, simply create a file ~/.kde/Autostart/xmodmap containing

Code: ~/.kde/Autostart/xmodmap
/usr/bin/xmodmap $HOME/.Xmodmap

and make it executable.

Note: If everything is configured but nothing happens on your Thinkpad, try to install kde-base/kmilo:

$ emerge -av kde-base/kmilo



Go to Desktop > Preferences > Keyboard Shortcuts, or run gnome-keyboard-bindings, whichever suits your fancy. Make sure the Sound category in the Actions column is expanded, then click on the desired action. The entry in the Shortcut column will change to "New accelerator...." Press the desired key for the binding, and the shortcut is made. A proper entry should look similar to

Volume muteXF86AudioMute

If you feel more comfortable with (or are just that more adventurous), open up Gnome's Configuration Editor, either through the menus, or through the command gconf-editor, then navigate to Apps > gnome_settings_daemon > keybindings. For the even-more-adventurous, use your favorite editor (such as vim), and open ~/.gconf/apps/gnome_settings_daemon/keybindings/%gconf.xml

A decent set to work with is:

File: ~/.gconf/apps/gnome_settings_daemon/keybindings/%gconf.xml
<?xml version="1.0"?>
        <entry name="www" mtime="1115511556" type="string">
        <entry name="email" mtime="1115511554" type="string">
        <entry name="next" mtime="1115511504" type="string">
        <entry name="previous" mtime="1115511503" type="string">
        <entry name="stop" mtime="1115511498" type="string">
        <entry name="play" mtime="1115511489" type="string">
        <entry name="volume_up" mtime="1116696662" type="string">
        <entry name="volume_down" mtime="1115511485" type="string">
        <entry name="volume_mute" mtime="1116697540" type="string">

Window Maker

Adding shortcuts to Window Maker is simple using the Window Maker Preferences Utility: WPrefs. By default WPrefs is the third icon down in the dock. If WPrefs is no longer in the dock, you can access it on most distros by running the following command in an X terminal:

$ /usr/lib/GNUstep/Applications/

You can go to the keyboard section of WPrefs to bind the extended keys to some predefined internal Window Maker commands.

Simply scroll right until the keyboard icon is visible and click on it.

You will see a list of internal commands that you can higlight. Select the command you want to bind and then click the "capture" button. Now simply hit the key and any modifiers (ctrl, alt, shift etc.) you want to bind to this function.

While binding internal Window Maker commands is useful, more useful is binding external commands to keystrokes. The only way to do this is to add them to the main Window Maker menu, the same menu you can access from right clicking on the root window or hitting F12 by default.

In WPrefs you can click on the menu icon: the one next to the keyboard icon to access the menu.
An editable version of the menu will pop up outside of the main WPref window. You can drag any of the sample elements from the main WPrefs window to the editable menu to create a new element of that type.
Double-click on an element in the editable menu to change its name. Be sure to press Enter after completing the name change or else it will revert.

Adding a shortcut to a program entry will result in the shortcut keysym showing up in the menu; It will not show up in the editable version of the menu. Because the keysyms are a bit ugly you can tidy up the menu by sticking the programs in a submenu.

You can add a shortcut to a "Run Program" element by selecting it in the dummy menu and clicking the "Capture" button then pressing the key/keystroke you want to bind to that program.

Enlightenment DR16

Emerge the e16keyedit package. Then run 'e16keyedit' inside of enlightenment. Create a new keybinding, and press the 'Change' button to record a keystroke. Just press your new multimedia key and bind it to whatever action you'd like (use the 'Run' action to bind it to a command like aumix). Remember to press the 'Save' button when you're done.

Ion 3

Copy /etc/X11/ion3/cfg_bindings.lua to ~/.ion3/cfg_bindings.lua (if you did not do this already) and edit it. By using kpress(KEY, ACTION) you can bind actions to multimedia keys:

File: ~/.ion3/cfg_bindings.lua
   bdoc("Mute/Unmute Sound."),
   kpress("AnyModifier+XF86AudioMute", "ioncore.exec_on(_, 'amixer sset Master toggle')"),
   bdoc("Increase Volume."),
   kpress("AnyModifier+XF86AudioRaiseVolume", "ioncore.exec_on(_, 'amixer sset Master 3%+')"),
   bdoc("Decrease Volume."),
   kpress("AnyModifier+XF86AudioLowerVolume", "ioncore.exec_on(_, 'amixer sset Master 3%-')"),

Note that in some later versions of ion3, key bindings have moved from cfg_bindings.lua to cfg_ioncore.lua. Same syntax, just a different file. If you don't have an /etc/X11/ion3/cfg_bindings.lua to copy, this is probably why.

FVWM and FVWM-Crystal

Add a binding in your configuration. FVWM-Crystal users can find a description of the modifiers used by Crystal in /usr/share/fvwm-crystal/fvwm/components/functions/Keyboard-Modifiers

Example for Crystal, I use the Aumix mixer here. For a system wide configuration, modify the file /usr/share/fvwm-crystal/fvwm/components/functions/Mixer-aumix, otherwise copy it in ~/.fvwm-crystal/components/functions and add:

File: ~/.fvwm-crystal/components/functions/Mixer-aumix
   Key XF86AudioLowerVolume A $[Mod0] Mixer-Volume-Down
   Key XF86AudioRaiseVolume A $[Mod0] Mixer-Volume-Up

Another example with FVWM functions, parameters, external command and key modifiers:

File: ~/.fvwm-crystal/components/functions/Music-myplayer
   # Same key with modifiers and call to an external program
   Key XF86AudioMute A $[Mod0] Exec exec alsaplayer --volume 0
   key XF86AudioMute A C Exec exec alsaplayer --volume 1
   # Another key with modifiers
   # + FVWM function
   key XF86AudioPlay A $[Mod0] Music-PlayPause
   key XF86AudioPlay A C Music-Pause
   # + FVWM function with parameter
   key XF86AudioPlay A $[Mod1] Music-Speed normal

An example with amixer:

File: fvwm multimedia key definition
   key XF86AudioLowerVolume 	A A Exec exec amixer set Front 10%-
   key XF86AudioRaiseVolume 	A A Exec exec amixer set Front 10%+ 
   key XF86AudioMute 		A A Exec exec amixer set Front toggle

FVWM-Crystal is using $[Mod0] which is not defined in plain FVWM. To determine the modifiers into FVWM, you can use the output of

xmodmap -pm

As $[Mod0] is defined as N (none) in Crystal and $[Mod1] as M for Meta (Alt), all that is needed is to replace all the occurrences of $[Mod0] by N and $[Mod1] by M:

Key XF86AudioLowerVolume A N Mixer-Volume-Down
Key XF86AudioRaiseVolume A N Mixer-Volume-Up
key XF86AudioPlay A N Music-Play
key XF86AudioPlay A C Music-Pause
key XF86AudioPlay A M Music-PlayPause

Sample: eMachines m68xx

If you own an eMachines m68xx notebook and want to jump right to using the keys, you can use the following to setup the keys. NB: These were created on an m6809, but I assume they're the same for the other m68xx models, if you have access to one of the other models and can confirm/deny this, please update this page.

First, we update the the keysyms. On an x86_64 system the file we want is /usr/lib64/X11/xkb/symbols/inet. Insert the following code:

File: /usr/lib64/X11/xkb/symbols/inet
 // eMachines

 partial alphanumeric_keys
 xkb_symbols "emachines" {
     name[Group1]= "Laptop/notebook eMachines m68xx";

     key <I2E> {       [ XF86AudioLowerVolume  ]       };
     key <I6D> {       [ XF86AudioMedia        ]       };
     key <I30> {       [ XF86AudioRaiseVolume  ]       };
     key <I20> {       [ XF86AudioMute ]       };
     key <I6C> {       [ XF86Mail      ]       };
     key <I32> {       [ XF86iTouch    ]       };
     key <I65> {       [ XF86Search    ]       };
     key <I5F> {       [ XF86Sleep     ]       };
     key <I22> {       [ XF86AudioPlay, XF86AudioPause ]       };
     key <I24> {       [ XF86AudioStop ]       };
     key <I10> {       [ XF86AudioPrev ]       };
     key <I19> {       [ XF86AudioNext ]       };
     key <KP0> {       [ KP_0  ]       };
     key <KP1> {       [ KP_1  ]       };
     key <KP2> {       [ KP_2  ]       };
     key <KP3> {       [ KP_3  ]       };
     key <KP4> {       [ KP_4  ]       };
     key <KP5> {       [ KP_5  ]       };
     key <KP6> {       [ KP_6  ]       };
     key <KP7> {       [ KP_7  ]       };
     key <KP8> {       [ KP_8  ]       };
     key <KP9> {       [ KP_9  ]       };
     key <KPDL>        {       [ KP_Decimal    ]       };
     key <KPAD>        {       [ KP_Add        ]       };
     key <KPSU>        {       [ KP_Subtract   ]       };
     key <KPMU>        {       [ KP_Multiply   ]       };
     key <KPDV>        {       [ KP_Divide     ]       };

Now, we add the required references to this keyboard layout to X11/kxb/rules/(xorg

In the xorg file we add it to the list of $inetkbds like so:

File: /usr/lib64/X11/xkb/rules/xorg
 ! $inetkbds = airkey acpi scorpius azonaRF2300 \
              brother \
              btc5113rf btc5126t btc9000 btc9000a btc9001ah btc5090\
              cherryblue cherrybluea cherryblueb \
              chicony chicony9885 \
              compaqeak8 compaqik7 compaqik13 compaqik18 armada presario ipaq \
              dell inspiron dtk2000 \
              dexxa diamond genius geniuscomfy2 \
              emachines ennyah_dkb1008 \
              hpi6 hp2501 hp2505 hp5181 hpxe3gc hpxe3gf hpxe4xxx hpzt11xx \
              hp500fa hp5xx hp5185 \
              honeywell_euroboard \
              rapidaccess rapidaccess2 rapidaccess2a \
              ltcd logiaccess logicdp logicdpa logicink logiciink \
              logiinkse logiinkseusb logiik itouch \
              mx1998 mx2500 mx2750 \
              microsoftinet microsoftpro microsoftprooem microsoftprose \
              microsoftoffice microsoftmult \
              oretec \
              propeller \
              qtronix \
              samsung4500 samsung4510 \
              sk1300 sk2500 sk6200 sk7100 \
              sven symplon toshiba_s3000 trust trustda yahoo

In xorg.lst we add one line among the large list of models.

File: /usr/lib64/X11/xkb/rules/xorg.lst
 emachines     Laptop/notebook eMachines m68xx

And finally in xorg.xml we give it a description, which can be localized.

File: /usr/lib64/X11/xkb/rules/xorg.xml
        <description>Laptop/notebook eMachines m68xx</description>

Now, after all that, restart your X server and there's a fresh new m68xx keyboard waiting to be selected. In KDE this can be selected easily by opening the Keyboard Layout Control Module and choosing the newly added "Laptop/notebook eMachines m68xx" from the Keyboard Model list. Any of the specials keys can then be bound as shortcuts the way you configure any other shortcut.

Since this is at the X server level, and system wide, it should be accessible to all users in any window manager.

Getting bizarre keyboards working

I have an HP keyboard that has a volume wheel. Unfortunately, this and half of the other buttons don't generate X keyboard events, so I wrote a perl script to take care of those keys. It's a bit of a pain to use, but it will get ANY keys or buttons that the keyboard sends working, by going to the low level evdev interface.

In the kernel, enable the "Event interface" driver (evdev module) to get kernel support.

Then, grab the photkeys script (Description: Download:, and follow the instructions there to set it up.

Code: You should run this script like this
gus alexg # photkeys /dev/input/event1
Unrecognized event: '4:4:28'. Define it in /usr/bin/photkeys
Unrecognized event: '4:4:139'. Define it in /usr/bin/photkeys

For me when I press buttons something appears in /dev/input/event1, may be in your system device file would be different.

... Or check one of this alternatives:

Command Line Functions to Control Common Applications

Many applications have methods to control them from command line. These are perfect for creating shortcuts to use with multimedia keys.

If you like to control all the apps below (and 20+ more apps) you will need a command wrapper like ReMoot. ReMoot can control xmms, Mplayer, Rhythmbox, Amarok, Quod Libet, xine, kaffeine and 20 more apps. The command 'remoote play' will control the active multimedia application and therefor you don't have to asign one key to one application. ReMoot works best with Lineak, Keytouch or xbindkeys and has a web-frontend that works remote control with a PDA or any web enabled gadget.


audacious has some straightforward command line switches. You can see more by executing this command in a terminal:

$ man audacious
Code: audacious command line switches from the audacious manpage
audacious --rew        # Skip backwards in playlist.
audacious --stop       # Stop current song.
audacious --play-pause # Pause if playing, play otherwise.
audacious --fwd        # Skip forward in playlist.


Rhythmbox can be controlled using the command line:

Code: rhythmbox-client command line switches
rhythmbox-client --previous   # Skip backwards in playlist
rhythmbox-client --next       # Skip forward in playlist
rhythmbox-client --play-pause # Pause if playing, play otherwise
rhythmbox-client --pause      # Pause


Code: amarok command line switches from "dcop amarok player" (v. 1.4.4)
QCStringList interfaces()
QCStringList functions()
QString version()
bool dynamicModeStatus()
bool equalizerEnabled()
bool osdEnabled()
bool isPlaying()
bool randomModeStatus()
bool repeatPlaylistStatus()
bool repeatTrackStatus()
int getVolume()
int sampleRate()
int score()
int rating()
int status()
int trackCurrentTime()
int trackCurrentTimeMs()
int trackPlayCounter()
int trackTotalTime()
QString album()
QString artist()
QString bitrate()
QString comment()
QString coverImage()
QString currentTime()
QString encodedURL()
QString engine()
QString genre()
QString lyrics()
QString lyricsByPath(QString path)
QString lastfmStation()
QString nowPlaying()
QString path()
QString setContextStyle(QString)
QString title()
QString totalTime()
QString track()
QString type()
QString year()
void configEqualizer()
void enableOSD(bool enable)
void enableRandomMode(bool enable)
void enableRepeatPlaylist(bool enable)
void enableRepeatTrack(bool enable)
void mediaDeviceMount()
void mediaDeviceUmount()
void mute()
void next()
void pause()
void play()
void playPause()
void prev()
void queueForTransfer(KURL url)
void seek(int s)
void seekRelative(int s)
void setEqualizer(int,int,int,int,int,int,int,int,int,int,int)
void setEqualizerEnabled(bool active)
void setEqualizerPreset(QString name)
void setLyricsByPath(QString url,QString lyrics)
void setBpm(float bpm)
void setBpmByPath(QString url,float bpm)
void setScore(int score)
void setScoreByPath(QString url,int score)
void setRating(int rating)
void setRatingByPath(QString url,int rating)
void setVolume(int volume)
void setVolumeRelative(int ticks)
void showBrowser(QString browser)
void showOSD()
void stop()
void transferDeviceFiles()
void volumeDown()
void volumeUp()
void transferCliArgs(QStringList args)

Quod Libet

Code: Quod Libet command line switches from "quodlibet --help"
 quodlibet --previous   # Skip backwards in playlist
 quodlibet --play       # Start playing current playlist
 quodlibet --play-pause # Play if stopped, pause if playing
 quodlibet --pause      # Pause playback
 quodlibet --next       # Skip forwards in playlis


If you use MPD your client may already support some keysyms. For instance gmpc correctly recognises XF86AudioNext, XF86AudioPrev, XF86AudioStop, and XF86AudioPlay. Furthermore, gmpc works with profiles, and whichever you have selected will be played, paused, stopped, next'd, or previous'd autimagically.

If you do not use gmpc, or do not want to leave gmpc running then you may want to bind these keys to short cuts to the command line MPD client, mpc. first you must install mpc by executing:

$ emerge mpc

The mpc command line switches are:

Code: mpc switches from "mpc --help"
mpc next     # Play the next song in the current playlist
mpc prev     # Play the previous song in the current playlist
mpc toggle   # Toggles Play/Pause, plays if stopped
mpc stop     # Stop the currently playing playlists


alsa can be controlled using amixer. The following commands will adjust the PCM levels of your ALSA soundcard.

Code: Controling PCM levels with amixer
amixer sset PCM 2+       # This will increase the PCM hardware volume value by 2
amixer sset PCM 2-       # This will decrease the PCM hardware volume value by 2
amixer sset PCM toggle   # This will toggle the PCM between muted and unmuted states

Not all sound cards support mute toggling. The following script can be used on such cards. It saves the current volume to $HOME/.lastVolume and sets it to 0. To "unmute", execute the script again and the previous value will be restored.

File: /usr/local/bin/muteVolume
# simple script to mute by changing volume
numid="30"   #find apropriate number with: amixer controls
volume=$(amixer cget numid=$numid | grep : | sed -e 's/  : values=//')
if [ $volume = '0' ] # Or if that doesn't work try: if [ $volume = '0,0' ]
	echo "Volume is 0, restoring"
	volume=$(cat $filename)
	amixer -q cset numid=$numid $volume &> /dev/null
 	echo "Volume is $volume, muting"
 	echo $volume > $filename
	amixer -q cset numid=$numid 0 &> /dev/null

(Verified with amixer 1.0.13)

Banshee player

Code: Banshee command line switches from "banshee --help"
Usage: banshee [ options ... ]
       where options include:
  --show              Show window
  --hide              Hide window
  --next              Play next song
  --previous          Play previous song
  --toggle-playing    Toggle playing of current song
  --play              Play current song
  --pause             Pause current song
  --shutdown          Shutdown Banshee

Goggles Music Manager

As of v0.7.4, Goggles Music Manager supports the following command line options:

Code: Goggles Music Manager command line options from "gmm --help"
 gmm --play        Start playback
 gmm --play-pause  Play if stopped, pause if playing
 gmm --pause       Pause playback
 gmm --previous    Play previous track
 gmm --next        Play next track
 gmm --stop        Stop playback

Getting illumination switching to work under X

To get switching on/off the illumination of multimedia keyboard to work under X using key Scroll_Lock: (my keyboard is hama EasyLine 00021018 USB which is reported by lsusb as ID 1241:1503 Belkin and has no separate switch for that)

Change mapping of Scroll_lock by extending ~.Xmodmap with something like this:

keycode  78 = XF86LightBulb

Keycode 78 is key Scroll_Lock on my keyboard. Of course you could use any other key you like. (I just piked XFLightBulb because it seemed to be not used and it sounds good.)

Make a little script somewere like this:

File: /usr/local/bin/kbd-illum
# /usr/local/bin/kbd-illum - control illumination of keyboard
case "$1" in
  ( on  ) xset  led 3 ;;
  ( off ) xset -led 3 ;;
  ( -t | --toggle )
    xsetleds -show | grep -q 'ScrollLock \+on' &&
    xset -led 3 || xset led 3 ;;
  ( -s | --status )
    xsetleds -show | grep -q 'ScrollLock \+on' &&
    echo on || echo off ;;
  ( * ) echo "usage: $( basename "$0" ) -t|--toggle | -s|--status | on | off"

and make it executable.

Of course you need xsetleds installed :)

emerge -n x11-misc/xsetleds

Then bind key XF86LightBulb to this command:

/usr/local/bin/kbd-illum --toggle

like explained above (I use KDE) and you are done.

Retrieved from ""

Last modified: Wed, 24 Sep 2008 02:36:00 +1000 Hits: 132,906

Created by, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.