summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/sxhkd/sxhkdrc20
-rwxr-xr-x.local/bin/reco15
2 files changed, 18 insertions, 17 deletions
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index 91d45433..8fce5bd9 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -1,5 +1,8 @@
Print
- ffmpeg -f x11grab -i "$DISPLAY" -vframes 1 "$XDG_PICTURES_DIR/screenshots/$(time.uuid)".png
+ xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -f x11grab -s "$1"x"$2" -i "$DISPLAY+$3,$4" -vframes 1 "$XDG_PICTURES_DIR/screenshots/$(time.uuid).png"' shell
+
+alt + Print
+ reco
XF86Audio{RaiseVolume,LowerVolume,Mute}
amixer set Master {5%+,5%-,toggle};\
@@ -12,6 +15,12 @@ alt + XF86AudioMute
amixer set Capture toggle;\
kill -RTMIN "$(cat ~/.cache/pidofbar)"
+XF86Audio{Prev,Play,Next}
+ playerctl {previous,play-pause,next}
+
+@Caps_Lock
+ kill -RTMIN+3 "$(cat ~/.cache/pidofbar)"
+
alt + y
mpvy -s
@@ -27,13 +36,4 @@ alt + w
alt + s
shufwall
-XF86Audio{Prev,Play,Next}
- playerctl {previous,play-pause,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
index c07e15b6..512a259a 100755
--- a/.local/bin/reco
+++ b/.local/bin/reco
@@ -1,6 +1,6 @@
#!/bin/sh
-# references:
+# useful urls:
# 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
@@ -12,7 +12,6 @@
# sbar wait signal approach? or not
# reco sbar status? so no notify-send
-# use tmp instead?
infofile="/tmp/recoinfo"
recodir="$XDG_VIDEOS_DIR/recordings/"
mkdir -p "$recodir"
@@ -21,13 +20,15 @@ if [ -e "$infofile" ]; then
read -r pid tmpfile < "$infofile"
kill "$pid"
notify-send 'finish recording, start converting'
- ffmpeg -i "$tmpfile" "$recodir/$(time.uuid).mkv" && notify-send 'finish converting'
+ ffmpeg -i "$tmpfile" "$recodir/$(time.uuid).mkv"
+ notify-send 'finish converting'
rm "$tmpfile" "$infofile"
else
tmpfile="$(mktemp --suffix '.mkv')"
notify-send 'start recording'
- # arch wiki way
- # no audio, less cpu use during capturing (fast?), large file size, need convert afterward
- ffmpeg -y -f x11grab -framerate 25 -i "$DISPLAY" -c:v ffvhuff "$tmpfile" &
- printf '%s\t%s' "$!" "$tmpfile" > "$infofile"
+ # arch wiki way, no audio, less cpu use during capturing (fast?), large file size, need convert afterward
+ xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -y -loglevel quiet -f x11grab -framerate 25 -s "$2"x"$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 "$2"x"$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1"' shell "$tmpfile" &
+ #printf '%s\t%s' "$(ps -o pid= --ppid $!)" "$tmpfile" > "$infofile"
fi