XMMS2 Hotkeys Example

From XMMS2

Jump to: navigation, search

There are currently two methods to use hotkeys with XMMS2. The xmms2-hotkey client is more advanced, but requires a few extra steps to configure.

Using xmms2-hotkey

The xmms2-hotkey client can control XMMS2 via hotkeys (which include mouse buttons.) It can use X-Windows hotkeys, but is also capable of using evdev devices if X11 is unavailable (or to bind actions to buttons that X11 can't see, but evdev can.)

Unlike XBindKeys, xmms2-hotkey can also use dual-hotkey combinations, to allow one hotkey to "activate" a whole host of other keys.

Using XBindKeys

In this example setup we're going to use the following keys:

  • Control + Shift + Z -> Previous track
  • Control + Shift + X -> Play
  • Control + Shift + C -> Pause
  • Control + Shift + V -> Stop
  • Control + Shift + B -> Next track
  • Control + Shift + Left -> Skip back 5 seconds
  • Control + Shift + Right -> Skip forward 5 seconds
  • Control + Shift + Up -> Increase volume by 1/32 (using alsa's amixer command)
  • Control + Shift + Down -> Decrease volume by 1/32
  • Control + Shift + L -> Launch esperanza
  • Control + Shift + G -> Launch gxmms2

(The Z X C V B keys are the keys in winamp and xmms 1 for prev, play, pause, stop and next respectively).

First, download and install XBindKeys. Debian users can just do 'apt-get install xbindkeys'.

XBindKeys reads key bindings from ~/.xbindkeysrc. If you've previously used XBindKeys, you already have an ~/.xbindkeysrc. If you don't have it, you'll have to create it (open your favourite text editor, type or paste then save as ~/.xbindkeysrc). The configuration options for our example are:

# xmms 2 keybindings
 
"xmms2 prev"
   Control+Shift + z
"xmms2 play"
   Control+Shift + x
"xmms2 pause"
   Control+Shift + c
"xmms2 stop"
   Control+Shift + v
"xmms2 next"
   Control+Shift + b
"xmms2 seek +5"
   Control+Shift + Right
"xmms2 seek -5"
   Control+Shift + Left
"amixer sset Master 1+"
   Control+Shift + Up
"amixer sset Master 1-"
   Control+Shift + Down
"esperanza"
   Control+Shift + l
"gxmms2"
   Control+Shift + g

Put these in ~/.xbindkeysrc and run 'xbindkeys' at a console.

To verify that it worked, press Control + Shift + X. If any is in the playlist, music should start playing, or start from the beggining of the track if it was already playing.

To verify some more, run 'xbindkeys_show'. A pop-up window should appear with the list of bound keys. These keys should be in the list.