Freitag, 24. September 2010

Enable seeking with hotkeys for xmms2

Intro

I study foreign languages with audio-books and transcripts. If I haven't understood a word I seek back a few seconds in the audio - manually until now by dragging the button on the seek bar of my favorite soundplayer gui.
This is of course tedious if your reading the transcript and have to refocus your eyes from the text to the seek bar and even seek back the correct amount of time.
I needed something more apt.

Specification
I'm running Debian 5 with Gnome and wanted
  • soundplayer with cli interface and capable of sending the following commands:
    • seek + amount of seconds to seek
    • toggle between play and stop
    • forward / backward track
  • bind the commands to the multimedia keys of my keyboard
Solution

I found the best solution being xmms2 as the soundplayer and xbindkeys for the key binding of the commands.


xmms2


xmms2 comes in a client/server architecture.
To start the sever in daemon mode invoke 'xmms2-launcher', but it can't be started as root.
A rudimentary gui for xmms2 is gxmms2.

Both xmms2 and xbindkeys have to be started each time you login, so I put them as autostart programs in 'System->Session->Autostart programs'.

xbindkeys


At first I had problems binding the multimedia keys, but then I read here that Debians/Ubuntus graphical keyboard shortcuts utility causes to suppress the keys of sending keycodes, as can be seen with the command 'xev'.
Solution: Remove the binding for these keys with the graphical shortcut utility, afterwards the keycodes show up.

A great tutorial on xbindkeys can be found here, for use of mouse, sending key combinations to programs (paket xautomation, program xte), graphical/sound responses

My .xbindkeysrc looks as follows (I use a Cherry G230 keyboard):

#Toggle between play/pause
"xmms2 toggleplay"
m:0x0 + c:162

#Seek +5 seconds
"xmms2 seek +5"
m:0x0 + c:153

#Seek -5 seconds
"xmms2 seek -5"
m:0x0 + c:144

Keine Kommentare: