summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/sxhkd/sxhkdrc5
-rwxr-xr-x.local/bin/reco29
2 files changed, 33 insertions, 1 deletions
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index c05dfc36..91d45433 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -1,4 +1,4 @@
-alt + Print
+Print
ffmpeg -f x11grab -i "$DISPLAY" -vframes 1 "$XDG_PICTURES_DIR/screenshots/$(time.uuid)".png
XF86Audio{RaiseVolume,LowerVolume,Mute}
@@ -33,4 +33,7 @@ XF86Audio{Prev,Play,Next}
@Caps_Lock
kill -RTMIN+3 "$(cat ~/.cache/pidofbar)"
+alt + Print
+ reco
+
# vim: ft=sh
diff --git a/.local/bin/reco b/.local/bin/reco
new file mode 100755
index 00000000..4d68bffd
--- /dev/null
+++ b/.local/bin/reco
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# references:
+# https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/dmenurecord
+# https://wiki.archlinux.org/title/FFmpeg#Screen_capture
+# https://trac.ffmpeg.org/wiki/Capture/Desktop
+
+# better notify-send? keep send notify-send when recording? or not
+# mktemp instead of time.uuid?
+
+# use tmp instead?
+infofile="$XDG_CACHE_HOME/recoinfo"
+recodir="$XDG_VIDEOS_DIR/recordings/"
+mkdir -p "$recodir"
+
+if [ -e "$infofile" ]; then
+ notify-send 'finish recording, start converting'
+ kill "$(head -n1 "$infofile")"
+ tmpfile="$(tail -n1 "$infofile")"
+ ffmpeg -i "$tmpfile" "$recodir/$(time.uuid).mkv" && notify-send 'finish converting'
+ rm "$tmpfile" "$infofile"
+else
+ notify-send 'start recording'
+ tmpfile="/tmp/$(time.uuid).mkv"
+ # arch wiki way
+ # no audio, less cpu use during capturing (fast?), large file size, need convert afterward
+ ffmpeg -f x11grab -framerate 25 -i "$DISPLAY" -c:v ffvhuff "$tmpfile" &
+ printf '%s\n%s' "$!" "$tmpfile" > "$infofile"
+fi