Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.14 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. resize_recoordinate_vlc()
  4. {
  5.   for i in $(seq 1 20); do
  6.     sleep 0.2
  7.     if xdotool getactivewindow getwindowname | grep 'VLC media player'; then
  8.       xdotool windowsize $(xdotool getactivewindow) $1 $2
  9.       xdotool windowmove $(xdotool getactivewindow) $3 $4
  10.       break
  11.     fi
  12.   done
  13. }
  14.  
  15. copy_chromium_address()
  16. {
  17.   xdotool key alt+d
  18.   xdotool key ctrl+c
  19. }
  20.  
  21. active_window_title_matches()
  22. {
  23.   xdotool getactivewindow getwindowname | grep -q "$1"
  24. }
  25.  
  26. if active_window_title_matches 'Twitch - Chromium'; then
  27.   copy_chromium_address
  28.   if xclip -o | grep -q 'https://www.twitch.tv/videos'; then
  29.     vlc --no-qt-video-autoresize $(xclip -o) &
  30.     resize_recoordinate_vlc 1280 $((720+104)) 270 $((212-26))
  31.   elif xclip -o | grep -q 'https://www.twitch.tv'; then
  32.     vlc --no-qt-video-autoresize --qt-minimal-view $(xclip -o) &
  33.     resize_recoordinate_vlc 1280 720 270 212
  34.   fi
  35. elif active_window_title_matches ' - YouTube - Chromium'; then
  36.   copy_chromium_address
  37.   if xclip -o | grep -q 'https://www.youtube.com/watch'; then
  38.     vlc --no-qt-video-autoresize $(xclip -o) &
  39.   fi
  40.   resize_recoordinate_vlc 1280 824 313 116
  41. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement