dot_testing/builds/utils/capture

46 lines
717 B
Bash
Executable File

#!/bin/sh
if [ "$IS_RUNNING_IN_TMENU" = "yes" ]; then
unset IS_RUNNING_IN_TMENU
st -c tmenu-prompt -e "$0"
exit
fi
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