#!/bin/sh display=$(xrandr \ | grep ' connected' \ | awk -F ' ' '{print $1}' \ | sed '1i select rectangle' \ | fzy) case "$display" in "select"*) geom=$(xrectsel) ;; *) geom=$(xrandr \ | grep "$display" \ | awk -F ' ' '{print $3 " " $4}' \ | sed 's/primary //g' \ | awk -F ' ' '{print $1}' \ | grep '[[:digit:]]' ) ;; esac printf "[] selected geometry is %s\n" "$geom" medium=$( printf ".mp4\n.png\n" | fzy ) printf "[] capturing in medium %s\n" "$medium" case "$medium" in *"mp4"*) ffcast -g $geom rec $HOME/output.mp4 ;; *"png"*) ffcast -g $geom png ;; esac