diff --git a/bash/bashrc b/bash/bashrc index 8d20282..1350f92 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -71,26 +71,45 @@ record() { fzy | awk -F' ' '{print $2}' ) - ffmpeg -video_size "$res" -f x11grab -framerate 60 -i $DISPLAY -preset ultrafast -pix_fmt yuv420p "$tmp.mp4" + medium=$(printf ".mp4\n.png\n" | fzy) + output="$tmp$medium" - printf "> written to %s\n" "$tmp.mp4" + case "$medium" in + *mp4*) + printf "> starting video capture...\n" + ffmpeg -video_size "$res" -f x11grab -framerate 60 -i $DISPLAY -preset ultrafast -pix_fmt yuv420p "$output" + ;; + *png*) + printf "> taking screenshot...\n" + # for a screenshot, we usually want an a s t h e t i c + ffmpeg -f x11grab -video_size "$res" -i $DISPLAY -vframes 1 "$output" -loglevel quiet # be quiet + ;; + *) + printf "not a choice\n" + return + esac + + printf "> written to %s\n" "$output" while true; do - set -x result=$(printf "delete\nmove to home directory\nupload to pastebin\nreview footage\nquit\n" | fzy --prompt="what next? ") case "$result" in *upload*) - paste "$tmp.mp4" | xclip -i + paste "$output" | xclip -i + printf "> pasted! check your clipboard\n" ;; *review*) - mpv "$tmp.mp4" + [ "$medium" = ".mp4" ] && mpv "$output" && continue + feh "$output" ;; *delete*) - rm "$tmp.mp4" + printf "> removing target file...\n" + rm "$output" return ;; *home*) - name=$(echo "capture.mp4" | fzy --prompt="name please? ") - mv "$tmp.mp4" "$HOME/$name.mp4" + printf "> warping your capture to home...\n" + name=$(echo "capture$medium" | fzy --prompt="name please? ") + mv "$output" "$HOME/$name" return ;; *quit*)