Global hotkeys for VLC

For reporting, I often need to fill in my notes with a recording I made of an interview.  This means I need global hotkeys so I can start/stop the player while I’m in my word processor or note-taking program (tomboy or zotero).

VLC has native support for global hotkeys, but for whatever reason, I couldn’t get them to work to map ++ to play/pause with Ubuntu 9.10.

My workaround is based on VLC global hotkeys in Ubuntu with Compiz. But, I use VLC’s remote control interface to control the player instead of the HTTP interface as suggested in the howto.

  • Make sure netcat is installed. We’ll use this to send controls to the remote control interface of VLC.
    $ sudo apt-get install netcat
  • Open up the CompizConfig:
    $ ccsm 
  • Click the checkbox next to Commands and then click on Commands
  • In the Commands tab, type echo “pause” | nc localhost 7777 -q 1 in the Command line 0 field (or the first available field if you have other commands). This command tells the play to toggle pausing the playback.
  • In the Commands tab, type echo “rewind” | nc localhost 7777 -q 1 in the Command line 1 field (or the first available field if you have other commands). This causes the player to rewind playback a few seconds.
  • In the Key Bindings tab, click the Disabled button in the row labeled Run command 0 (or whatever command you specified in the previous steps) and set the hotkey to whatever you want (I use ++).
  • Repeat the previous step for the rewind command (I used ++ because ++ was a hotkey used by another program).
  • Close CompizConfig.

Then, if I run VLC with both the normal and remote control  control interfaces, setting up the remote control interface on port 7777 on my local machine, my global hotkey will work:

$ vlc --extraintf rc --rc-host localhost:7777

You might want to create an alias for running vlc with these options by editing ~/.bash_aliases or ~/.bashrc:

...
alias vlctranscribe='vlc --extraintf rc --rc-host localhost:7777'
...

I’m not quite sure how all the remote control commands work.  For instance, I thought the rewind command would play backwards at the maximum rate, but instead it jumps playback back a few seconds.  I thought the fastforward command would do the opposite of rewind, but instead it slows down playback incrementally.  So, for now, I just have play/pause and jump backwards hotkeys, but that’s enough to make transcribing interview recordings much, much easier.