#!/bin/sh record() { sleep 2 ffmpeg -f x11grab -r 30 -s 1920x1080 -i :0.0 -f alsa -i recorder \ -c:v libx264 -preset ultrafast \ -c:a libopus -b:a 96k -ac 2 -ar 48000 \ -y recording.mkv & } if test "$1" = start; then fish -ic 'set -U AUDIO record' record & disown else fish -ic 'set -U AUDIO' pkill ffmpeg fi