#!/bin/bash file=$1 while true do # get the window id WID=`xdotool search "mpv" | head -1` if [ -z "$WID" ]; then mpv $file & # got to wait for mpv to start before doing anything again sleep 1 continue fi t=`shuf -i0-2 -n1` t="0.$t" # random sleep to add variance to keystrokes sleep $t val=`shuf -i0-1 -n1| bc` if [ $val -eq 0 ]; then xdotool key --window $WID Up else xdotool key --window $WID Down fi dmesg > dmesg.txt done