videotoggle (332B)
1 #!/bin/sh 2 # remember `chmod g+rw /dev/video[01]` 3 4 if [ "$(uname)" = "OpenBSD" ]; then 5 videocmd="video" 6 procstr="$videocmd" 7 else 8 videocmd="mplayer -name botright tv:// -tv device=/dev/video0" 9 procstr="-f mplayer" 10 fi 11 12 if pgrep $procstr ; then 13 pkill $procstr 14 else 15 nohup $videocmd >/dev/null 2>&1 & 16 sleep 0.5 17 xdotool click 1 18 fi