Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got an old keyboard (Compaq 9009) with multimedia keys.

How can I use these keys as shortcuts?

share|improve this question

In short steps:

  1. Find the keycode using e.g. xev. Just start xev 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.

  2. Add the key codes to ~/.Xmodmap. Sample syntax:

    keycode 144 = XF86AudioPrev
    keycode 153 = XF86AudioNext
    keycode 176 = XF86AudioRaiseVolume
    keycode 174 = XF86AudioLowerVolume
  3. 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.

share|improve this answer
You might be able to skip step 2 completely, which is always nice. – Rob May 17 '12 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .