dot_testing/builds/utils/capture

40 lines
608 B
Plaintext
Raw Permalink Normal View History

2024-07-25 00:51:56 -05:00
#!/bin/sh
2024-05-12 17:08:24 -05:00
display=$(xrandr \
| grep ' connected' \
| awk -F ' ' '{print $1}' \
| sed '1i select rectangle' \
| fzy)
2023-01-15 16:48:49 -06:00
2024-05-12 17:08:24 -05:00
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
2023-01-15 16:48:49 -06:00
2024-05-12 17:08:24 -05:00
printf "[] selected geometry is %s\n" "$geom"
medium=$(
printf ".mp4\n.png\n" | fzy
)
printf "[] capturing in medium %s\n" "$medium"
2023-01-15 16:48:49 -06:00
case "$medium" in
2024-05-12 17:08:24 -05:00
*"mp4"*)
2024-07-25 00:51:56 -05:00
ffcast -g $geom rec $HOME/output.mp4
2023-01-15 16:48:49 -06:00
;;
2024-05-12 17:08:24 -05:00
*"png"*)
ffcast -g $geom png
2023-01-15 16:48:49 -06:00
;;
esac