summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Pan <xyz@flylightning.xyz>2024-07-22 18:02:15 -0700
committerXiao Pan <xyz@flylightning.xyz>2024-07-22 18:02:15 -0700
commitc0aeb0eabe1813f7e24a689b20c1b311403e5ba7 (patch)
tree50428536627a49624e8ce11f1c35dfe8db6ef18f
parent33fdceba0bea632bf942f1dbcd815e2d0ff57f58 (diff)
reco better prompt notification
-rwxr-xr-xsh/reco25
1 files changed, 16 insertions, 9 deletions
diff --git a/sh/reco b/sh/reco
index 054579e..6eed281 100755
--- a/sh/reco
+++ b/sh/reco
@@ -19,16 +19,23 @@ if [ -e "$infofile" ]; then
rm "$tmpfile" "$infofile"
else
tmpfile="$tmpdir/$(time-uuid).mkv"
- notify-send 'start recording after 1 second'
- sleep 1
- dunstctl close
# arch wiki way, no audio, less cpu use during capturing (fast?), large file size, need convert afterward
- case "$1" in
- # fullscreen
- '-f') printf '%s %s 0 0' "$SCR_WIDTH" "$SCR_HEIGHT";;
- '') xrectsel '%w %h %x %y';;
- *) exit 1;
- esac | xargs sh -c 'ffmpeg -y -loglevel quiet -f x11grab -framerate 25 -s "$2x$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1" & echo $!' shell "$tmpfile" | xargs -I {} printf '%s\t%s' '{}' "$tmpfile" > "$infofile"
+ {
+ case "$1" in
+ # fullscreen
+ '-f')
+ printf '%s %s 0 0' "$SCR_WIDTH" "$SCR_HEIGHT"
+ ;;
+ '')
+ notify-send 'select recording region with mouse'
+ xrectsel '%w %h %x %y'
+ ;;
+ *) exit 1;
+ esac
+ notify-send 'start recording after 2 seconds'
+ sleep 2
+ dunstctl close-all
+ } | xargs sh -c 'ffmpeg -y -loglevel quiet -f x11grab -framerate 25 -s "$2x$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1" & echo $!' shell "$tmpfile" | xargs -I {} printf '%s\t%s' '{}' "$tmpfile" > "$infofile"
# another way to get subshell ffmpeg child pid
#xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -y -f x11grab -framerate 25 -s "$2x$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1"' shell "$tmpfile" &
#printf '%s\t%s' "$(ps -o pid= --ppid $!)" "$tmpfile" > "$infofile"