Advertisement
Guest User

Firefox Starter for XBMC Amazon Plugin

a guest
Aug 21st, 2013
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.57 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Helper script to run Firefox inside XBMC and add some controls to it
  4.  
  5. # Start firefox
  6. /usr/bin/firefox $* &
  7. ffpid=$!
  8.  
  9. # Super-brittle... Needs to wait until the stream has finished initializing...
  10. sleep 10
  11.  
  12. # Switch Firefox to fullscreen and start playback
  13. xdotool mousemove 300 300 sleep .2 click -repeat 2 1 sleep 5 key space
  14.  
  15. # Set up xbindkeys for remote control commands
  16. # These are for a cheap MCE control, might be different for others...
  17.  
  18. cat > /tmp/xbk.$$ << EOF
  19. # Toggle fullscreen. Usefull if the startup fullscreen didn't work
  20. "echo Full ; xdotool mousemove 300 300 sleep .2 click -repeat 2 1"
  21.   m:0x0 + c:166
  22.   XF86Back
  23.  
  24. # Stop playing and close FF
  25. "echo ESC  ; xdotool key space mousemove 300 300  sleep .2 click -repeat 2 1 mousemove 300 30 sleep .5 click 1 key ctrl+w"
  26.   Escape
  27.  
  28. "echo Stop ; xdotool key space mousemove 300 300  sleep .2 click -repeat 2 1 mousemove 300 30 sleep .5 click 1 key ctrl+w"
  29.   m:0x0 + c:174
  30.   XF86AudioStop
  31.  
  32. # Play/Pause toggle
  33. "echo Play ; xdotool  key space"
  34.   m:0x0 + c:215
  35.   XF86AudioPlay
  36.  
  37. "echo Pause ; xdotool key space"
  38.   Pause
  39.  
  40. # Rewind
  41. "echo Rew ; xdotool  key Left"
  42.   m:0x0 + c:176
  43.   XF86AudioRewind
  44.  
  45. # Forward
  46. "echo Forw ; xdotool  key Right"
  47.   m:0x0 + c:216
  48.   XF86AudioForward
  49.  
  50. # Raise volume
  51. "echo Raise ; xdotool key Up"
  52.   m:0x0 + c:123
  53.   XF86RaiseVolume
  54.  
  55. # Lower volume
  56. "echo Lower ; xdotool key Down"
  57.   m:0x0 + c:122
  58.   XF86LowerVolume
  59.  
  60. EOF
  61.  
  62. xbindkeys -n -f /tmp/xbk.$$ &
  63. xbpid=$!
  64.  
  65. # Wait for FF to end
  66. wait $ffpid
  67.  
  68. # Kill XBindkeys
  69. kill $xbpid
  70.  
  71. # Done.
  72. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement