#!/bin/bash endrec () { killall -s SIGINT wf-recorder dunstctl close $nid notify-send "recording ended - output to $outfile" } mkdir -p ~/Videos statecon=$( pidof wf-recorder ) outfile="$HOME/Videos/$(date +'%Y%m%d%H%M%S').mp4" #$outfile nid="" if [ "$statecon" == '' ]; then wf-recorder -g "$(slurp)" -f $outfile & $nid=$(notify-send -p -u critical -t 0 "recording started" --action="goto endrecplace" ) else endrec fi pidof wf-recorder && endrec