Monday, September 3, 2012

Enable Multimedia Keys in VLC and Xubuntu

By default VLC ignores keyboard multimedia keys (Play, Next/Prev, Stop). In this article we'll be fixing that by configuring VLC's global hotkeys.

Configure Hotkeys

Open a terminal window and run:

vlcrc="$HOME/.config/vlc/vlcrc"
sed -i 's/#global-key-play-pause=/global-key-play-pause=Media Play Pause/' $vlcrc
sed -i 's/#global-key-next=/global-key-next=Media Next Track/' $vlcrc
sed -i 's/#global-key-prev=/global-key-prev=Media Prev Track/' $vlcrc
sed -i 's/#global-key-stop=/global-key-stop=Media Stop/' $vlcrc

VLC must be restarted for settings take effect.

Alternative method

The same can be accomplished configuring the hotkeys by hand. Open hotkeys preferences: Tools > Preferences > Hotkeys. Then select each action (Play, Next, Prev, Stop) double-clicking the "Global" column and hit the corresponding multimedia key.

6 comments:

  1. Excellent!
    Can you add fast forward/backward please? I will tell you why, i use DroidMote and by adding the guide's media keys, i managed to make DroidMote media keys to work with VLC.
    Thanks in advanced!

    ReplyDelete
    Replies
    1. There are already shortcuts for what VLC sees as fast forward:

      Short Forward Jump: Shift+Right
      Short Backward Jump: Shift+Left
      Long Forward Jump: Ctrl+Right
      Long Backward Jump: Ctrl+Left

      Delete
  2. i know but there's not global media keys and that's what i need...

    ReplyDelete
  3. Is this vlcrc just an average config file or some sort of fifo that you use to control a running instance?

    I can control vlc with commands such as "vlc --key-prev p playlist.m3u", but it won't work quite like I was expecting. On the actual interface the "p" key will return to the previously played song, even if it's set on random playlist. But via commandline it will be a "random previous", wich isn't previous at all, just random.

    What a stupid confusing command line interface. Why the redundancy of "--key- ", instead of something like "vlc ", that would assume the current playlist, like mpc does?

    ReplyDelete
    Replies
    1. vlcrc is just a regular configuration file.

      Delete
  4. I could kiss you for how much time you saved me, thanks man.

    ReplyDelete