Topic: Control VLC Using Multimedia Keys
13.04.2011 - Update : IF you have stumbled across this post please check this new one about using a Unix socket which works better http://crunchbanglinux.org/forums/post/112035/#p112035
VLC has plenty of options for using shortcut keys however these only work when the VLC interface has focus. I am not aware of an easy way to control VLC using multimedia key bindings when it does not have focus so I did some searching and found this article:
It's a little bit hackish but it works.
I then created this script:
vi ~/bin/controlvlc.sh#!/bin/bash
case $1 in
next) A="wget -q -t 1 -O - http://127.0.0.1:8080/?control=next" ;;
prev) A="wget -q -t 1 -O - http://127.0.0.1:8080/?control=previous" ;;
play-pause) A="wget -q -t 1 -O - http://127.0.0.1:8080/?control=pause" ;;
stop) A="wget -q -t 1 -O - http://127.0.0.1:8080/?control=stop" ;;
*) echo "Usage: $0 { next | prev | play-pause | stop }" ;;
esac
exec $Achmod +x ~/bin/controlvlc.shOpen VLC.
Go to: Tools > Preferences > Change "Show Settings" to "All" > Interface > Main Inteface > Select "HTTP remote control interface".
Click Save.
Restart VLC.
Add the following to the "<!-- Keybindings for running applications -->" section of Openbox's rc.xml
vi ~/.config/openbox/rc.xml <keybind key="XF86AudioPlay">
<action name="Execute">
<execute>controlvlc.sh play-pause</execute>
</action>
</keybind>
<keybind key="XF86AudioNext">
<action name="Execute">
<execute>controlvlc.sh next</execute>
</action>
</keybind>
<keybind key="XF86AudioStop">
<action name="Execute">
<execute>controlvlc.sh stop</execute>
</action>
</keybind>
<keybind key="XF86AudioPrev">
<action name="Execute">
<execute>controlvlc.sh prev</execute>
</action>
</keybind>Reconfigure Openbox and try your multimedia keys in VLC.
Cheers!
Last edited by jelloir (2011-04-13 12:19:20)