dot_testing/builds/utils/sh/capture
2024-05-12 17:08:24 -05:00

38 lines
580 B
Plaintext
Executable File

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
;;
*"png"*)
ffcast -g $geom png
;;
esac