aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2020-12-14 03:59:12 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2020-12-14 03:59:12 +0300
commitdea3bdf5dcf5dced5641747cea1032797c909437 (patch)
treea1beaf7cf931bcf75e7d69a65caf216767ad6c21
parent9b6a8eb73df962faf29572af22278c3af7cba159 (diff)
downloadswayrice-dea3bdf5dcf5dced5641747cea1032797c909437.tar.gz
swayrice-dea3bdf5dcf5dced5641747cea1032797c909437.zip
swayrecord: fix for single monitor cases
Turns out jq returns the value with quotes by default.
-rwxr-xr-xdotfiles/.local/bin/swayrecord12
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