#!/bin/bash if ! command -v slop >/dev/null; then echo "capture: slop not found" >&2 exit 1 fi out=${1:-$(date +%Y%m%d-%H%M%S).png} coords=$(slop -f "%x %y %w %h" 2>/dev/null) || exit 1 read x y w h <<<"$coords" ffmpeg -f x11grab -loglevel error -s ${w}x${h} \ -i ${DISPLAY}+${x},${y} -frames:v 1 -y "$out" echo "$out"