diff options
Diffstat (limited to 'dotfiles')
-rwxr-xr-x | dotfiles/.local/bin/swayrecord | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/dotfiles/.local/bin/swayrecord b/dotfiles/.local/bin/swayrecord index 23171e2..13b6e4d 100755 --- a/dotfiles/.local/bin/swayrecord +++ b/dotfiles/.local/bin/swayrecord @@ -10,6 +10,7 @@ if ! [ -d $AREC_DIR ]; then mkdir -p $AREC_DIR fi +DISPLAY="" OUTPUT="$(date '+%y%m%d-%H%M-%S')" TYPE="$1" VIDEO_PID="" @@ -69,7 +70,7 @@ killrecording () { } video () { - wf-recorder -f "$VREC_DIR/video-$OUTPUT.mp4" & + wf-recorder -o "$DISPLAY" -f "$VREC_DIR/video-$OUTPUT.mp4" & VIDEO_PID=$! echo $$ > ~/.cache/recordingpid echo "🔴" > ~/.cache/recordingicon @@ -83,7 +84,7 @@ screenshare () { loopbackcam="$(v4l2-ctl --list-devices | \ grep v4l2loopback -m1 -A1 | \ sed -e '1d' -e 's/\s//g')" - wf-recorder -x yuv420p -c rawvideo -m v4l2 -f $loopbackcam & + wf-recorder -o "$DISPLAY" -x yuv420p -c rawvideo -m v4l2 -f $loopbackcam & VIDEO_PID=$! echo $$ > ~/.cache/recordingpid echo "📺" > ~/.cache/recordingicon @@ -93,7 +94,7 @@ screenshare () { } screencast () { - wf-recorder -f "$VREC_DIR/temp-$OUTPUT.mp4" & + wf-recorder -o "$DISPLAY" -f "$VREC_DIR/temp-$OUTPUT.mp4" & VIDEO_PID=$! ffmpeg -f alsa -i default -c:a mp3 "$VREC_DIR/temp-$OUTPUT.mp3" & AUDIO_PID=$! @@ -130,6 +131,12 @@ if [ -f "$HOME/.cache/recordingpid" ]; then exit fi +if [ $(swaymsg -t get_outputs | jq '. | length') -gt 1 ]; then +DISPLAY=$(swaymsg -t get_outputs | grep -E "name" | sed "s/^.*\"name\": \"//g;s/\",$//g;" | bemenu -p "Select display for capture: " --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") +else + DISPLAY="$(swaymsg -t get_outputs | jq '.[0][\"name\"]')" +fi + case $1 in video) video;; screencast) screencast;; |