commit bc2a390313ab76df6e5e6ba62fec85bc1d51ca3a parent 1fbeb95ca78b9e22454688d1d11d8335750b42c9 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 28 Jan 2021 10:11:14 +0100 videotoggle: fix on linux Diffstat:
M | .local/bin/videotoggle | | | 15 | +++++++++++---- |
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/.local/bin/videotoggle b/.local/bin/videotoggle @@ -1,11 +1,18 @@ #!/bin/sh # remember `chmod g+rw /dev/video[01]` -if pgrep video >/dev/null 2>&1; then - pkill video +if [ "$(uname)" = "OpenBSD" ]; then + videocmd="video" + procstr="$videocmd" else - nohup sh -c 'video -f /dev/video1 || video ' \ - >/dev/null 2>&1 & + videocmd="mplayer -name botright tv:// -tv device=/dev/video0" + procstr="-f mplayer" +fi + +if pgrep $procstr ; then + pkill $procstr +else + nohup $videocmd >/dev/null 2>&1 & sleep 0.5 xdotool click 1 fi