Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Helper script to run Firefox inside XBMC and add some controls to it
- # Start firefox
- /usr/bin/firefox $* &
- ffpid=$!
- # Super-brittle... Needs to wait until the stream has finished initializing...
- sleep 10
- # Switch Firefox to fullscreen and start playback
- xdotool mousemove 300 300 sleep .2 click -repeat 2 1 sleep 5 key space
- # Set up xbindkeys for remote control commands
- # These are for a cheap MCE control, might be different for others...
- cat > /tmp/xbk.$$ << EOF
- # Toggle fullscreen. Usefull if the startup fullscreen didn't work
- "echo Full ; xdotool mousemove 300 300 sleep .2 click -repeat 2 1"
- m:0x0 + c:166
- XF86Back
- # Stop playing and close FF
- "echo ESC ; xdotool key space mousemove 300 300 sleep .2 click -repeat 2 1 mousemove 300 30 sleep .5 click 1 key ctrl+w"
- Escape
- "echo Stop ; xdotool key space mousemove 300 300 sleep .2 click -repeat 2 1 mousemove 300 30 sleep .5 click 1 key ctrl+w"
- m:0x0 + c:174
- XF86AudioStop
- # Play/Pause toggle
- "echo Play ; xdotool key space"
- m:0x0 + c:215
- XF86AudioPlay
- "echo Pause ; xdotool key space"
- Pause
- # Rewind
- "echo Rew ; xdotool key Left"
- m:0x0 + c:176
- XF86AudioRewind
- # Forward
- "echo Forw ; xdotool key Right"
- m:0x0 + c:216
- XF86AudioForward
- # Raise volume
- "echo Raise ; xdotool key Up"
- m:0x0 + c:123
- XF86RaiseVolume
- # Lower volume
- "echo Lower ; xdotool key Down"
- m:0x0 + c:122
- XF86LowerVolume
- EOF
- xbindkeys -n -f /tmp/xbk.$$ &
- xbpid=$!
- # Wait for FF to end
- wait $ffpid
- # Kill XBindkeys
- kill $xbpid
- # Done.
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement