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. This is actually kind of simple if you know how to do it. Here's how:

  1. In terminal, type xev.

  2. A window will pop up. Press all of the media keys you want to enable, one-by-one. Then Alt+F4 out of the popup.
  3. For each keypress, xev will output a bunch of gobbledegook that looks like this:

KeyPress event, serial 31, synthetic NO, window 0x3c00001,
root 0x44, subw 0x0, time 2040314804, (174,-11), root:(725,318),
state 0x0, '''keycode 42''' (keysym 0x67, g), same_screen YES,
XLookupString gives 1 bytes: (67) "g"
XmbLookupString gives 1 bytes: (67) "g"
XFilterEvent returns: False

KeyRelease event, serial 31, synthetic NO, window 0x3c00001,
root 0x44, subw 0x0, time 2040314884, (174,-11), root:(725,318),
state 0x0, '''keycode 42''' (keysym 0x67, g), same_screen YES,
XLookupString gives 1 bytes: (67) "g"

We're interested in the keycodes.

  1. Write down each keycode and its corresponding media key (you'll have to remember the order you pressed them in, unless you want to type xev in over and over again).
  2. Check out this page: http://keytouch.sourceforge.net/howto_keyboard.html Scroll down for a bit and it will show you all of the special XF86 symlinks. They all start with XF86.

  3. In your home directory, create a new file .Xmodmap (you can actually name it whatever you want, but .Xmodmap is conventional)
  4. Follow this format to create your file:

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

If xev gave keycode 174 when you hit your Volume Down button, you would have keycode 174 = XF86AudioLowerVolume just like here.

  1. Don't give up! Almost done. Go to your Xfce Menu -> Settings -> Keyboard Settings. Go to the Shortcuts tab and hit the left "Add" button to create your own Shortcut Profile.

  2. At this point, you'll have to create shortcuts for each button. You will need to figure out the command line instructions for your media player on your own, but once you know them, hit the right "Add" button, enter the command, hit your media key and you're done.
  3. Last step: In terminal, make sure you're in your home directory and type xmodmap .Xmodmap. This will activate the symlinks.

Here are some examples of command line instructions for different media players:

  • dcop amarok play
  • dcop amarok prev

(sudo apt-get install amarok to install amaroK)

  • aumix -v+10
  • aumix -v-10

(sudo apt-get install aumix to install aumix's command-line volume changing support)

  • mpc next
  • mpc prev

(sudo apt-get install mpd mpc gmpc to install MPD and its two client programs, (G)MPC)

  • exaile (show/hide player)
  • exaile -t (play/pause)
  • exaile -s (stop)
  • exaile -p (previous)
  • exaile -n (next)

(sudo apt-get install exaile to install exaile (amarok based player for GTK/Gnome, not KDE)

XfceMultimediaKeys (last edited 2008-07-24 17:11:14 by localhost)