#!/bin/zsh pidfile=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/recording.status win=$(xdotool getactivewindow) if [[ -e $pidfile ]] then read pid file < $pidfile kill -INT $pid xclip <<<$file notify-send "Recording stopped" rm $pidfile exit fi file=~/Videos/screengrab-$(date +%FT%T).ogv recordmydesktop --windowid=$win --no-sound -o $file --on-the-fly-encoding & echo $! $file> $pidfile notify-send "Recording window $(xdotool getwindowname $win)"