diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-12-14 03:59:12 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-12-14 03:59:12 +0300 |
commit | dea3bdf5dcf5dced5641747cea1032797c909437 (patch) | |
tree | a1beaf7cf931bcf75e7d69a65caf216767ad6c21 /dotfiles/.local | |
parent | 9b6a8eb73df962faf29572af22278c3af7cba159 (diff) | |
download | swayrice-dea3bdf5dcf5dced5641747cea1032797c909437.tar.gz swayrice-dea3bdf5dcf5dced5641747cea1032797c909437.zip |
swayrecord: fix for single monitor cases
Turns out jq returns the value with quotes by default.
Diffstat (limited to 'dotfiles/.local')
-rwxr-xr-x | dotfiles/.local/bin/swayrecord | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/dotfiles/.local/bin/swayrecord b/dotfiles/.local/bin/swayrecord index 13b6e4d..27593be 100755 --- a/dotfiles/.local/bin/swayrecord +++ b/dotfiles/.local/bin/swayrecord @@ -10,7 +10,7 @@ if ! [ -d $AREC_DIR ]; then mkdir -p $AREC_DIR fi -DISPLAY="" +MONITOR="" OUTPUT="$(date '+%y%m%d-%H%M-%S')" TYPE="$1" VIDEO_PID="" @@ -70,7 +70,7 @@ killrecording () { } video () { - wf-recorder -o "$DISPLAY" -f "$VREC_DIR/video-$OUTPUT.mp4" & + wf-recorder -o "$MONITOR" -f "$VREC_DIR/video-$OUTPUT.mp4" & VIDEO_PID=$! echo $$ > ~/.cache/recordingpid echo "🔴" > ~/.cache/recordingicon @@ -84,7 +84,7 @@ screenshare () { loopbackcam="$(v4l2-ctl --list-devices | \ grep v4l2loopback -m1 -A1 | \ sed -e '1d' -e 's/\s//g')" - wf-recorder -o "$DISPLAY" -x yuv420p -c rawvideo -m v4l2 -f $loopbackcam & + wf-recorder -o "$MONITOR" -x yuv420p -c rawvideo -m v4l2 -f $loopbackcam & VIDEO_PID=$! echo $$ > ~/.cache/recordingpid echo "📺" > ~/.cache/recordingicon @@ -94,7 +94,7 @@ screenshare () { } screencast () { - wf-recorder -o "$DISPLAY" -f "$VREC_DIR/temp-$OUTPUT.mp4" & + wf-recorder -o "$MONITOR" -f "$VREC_DIR/temp-$OUTPUT.mp4" & VIDEO_PID=$! ffmpeg -f alsa -i default -c:a mp3 "$VREC_DIR/temp-$OUTPUT.mp3" & AUDIO_PID=$! @@ -132,9 +132,9 @@ if [ -f "$HOME/.cache/recordingpid" ]; then 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") +MONITOR=$(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\"]')" + MONITOR="$(swaymsg -t get_outputs | jq -r '.[0]["name"]')" fi case $1 in |