|
Control VLC via global hotkeys (xbindkeys) under Linux |
|
|
|
If you also like VLC but miss global hot keys for linux follow this tutorial. (Tested with Ubuntu but does not need any special features. Just replace apt-get!)
- Open up the Terminal
- Enter sudo apt-get install xbindkeys
- Enter gedit .xbindkeysrc
- Enter the following config:
#Next "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=next" m:0x10 + c:171 Mod2 + XF86AudioNext
#Prev "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=previous" m:0x10 + c:173 Mod2 + XF86AudioPrev
#Play-Pause "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=pause" m:0x10 + c:172 Mod2 + XF86AudioPlay
#Stop "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=stop" m:0x10 + c:174 Mod2 + XF86AudioStop
#Start "vlc" m:0x10 + c:179 Mod2 + XF86Tools
- Save and close the editor window
- Enter xbindkeys &
- You might want to add this to your session. Go to GNOME Menu > System > Preferences > Session and add /usr/bin/xbindkeys to do so.
- Open up Videolan (VLC media player)
- Go to Preferences > Interface > General > Interface module: http remote control interface and check the box
- Click Save
- Restart Videolan (VLC)
- If the keys are not configured as you like you may use sudo apt-get install xbindkeys-config followed by xbindkeys-config. More information.
Rhythmbox
- If you want to extend the control functionality to Rhythmbox create a file with the following content:
#!/usr/bin/python import sys import dbus
# Start dbus session_bus = dbus.SessionBus()
# Connect to player proxy_obj = session_bus.get_object( 'org.gnome.Rhythmbox', '/org/gnome/Rhythmbox/Player')
player = dbus.Interface(proxy_obj, 'org.gnome.Rhythmbox.Player')
if sys.argv[1] == "1": player.next() elif sys.argv[1] == "2": player.previous() elif sys.argv[1] == "3": player.playPause(0) elif sys.argv[1] == "4": if player.getPlaying() != 0: player.playPause(0)
- Then change your .xbindkeysrc file:
#Next "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=next; python path_to_the_file.py 1" m:0x10 + c:171 Mod2 + XF86AudioNext
#Prev "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=previous; python path_to_the_file.py 2" m:0x10 + c:173 Mod2 + XF86AudioPrev
#Play-Pause "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=pause; python path_to_the_file.py 3" m:0x10 + c:172 Mod2 + XF86AudioPlay
#Stop "wget -q -t 1 -O - http://127.0.0.1:8080/old/?control=stop; python path_to_the_file.py 4" m:0x10 + c:174 Mod2 + XF86AudioStop
#Start "vlc" m:0x10 + c:179 Mod2 + XF86Tools
- Replace path_to_the_file with the real path!
- Take care: Using this script you control both players. To avoid problems only keep one of the two players open at the same time.
The information provided in this website is provided "as is" with no warranties of any kind, express or implied, including but not limited to: no warranty of merchantability, no warranty of fitness for a particular purpose, and no warranty of non-infringement. |