diff --git a/capture.sh b/capture.sh new file mode 100644 index 0000000..b07f8ca --- /dev/null +++ b/capture.sh @@ -0,0 +1,16 @@ +#!/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"