Fix scrrec not aborting previous sessions
This commit is contained in:
parent
6154e38eec
commit
187bdbd9fa
15
bin/scrrec
15
bin/scrrec
|
@ -10,8 +10,6 @@
|
||||||
# Usage: scrrec somefile.mp4
|
# Usage: scrrec somefile.mp4
|
||||||
# scrrec another.gif
|
# scrrec another.gif
|
||||||
|
|
||||||
shift # Get rid of extraneous nix-shell argument
|
|
||||||
|
|
||||||
is_script=
|
is_script=
|
||||||
geom=
|
geom=
|
||||||
delay=1
|
delay=1
|
||||||
|
@ -62,25 +60,28 @@ recording-start() {
|
||||||
local mp4dest=
|
local mp4dest=
|
||||||
[[ $dest == *.gif ]] && mp4dest="${dest%.*}.mp4"
|
[[ $dest == *.gif ]] && mp4dest="${dest%.*}.mp4"
|
||||||
countdown
|
countdown
|
||||||
touch $stopfile
|
ffmpeg $ffmpeg_opts "${mp4dest:-$dest}" &
|
||||||
ffmpeg $ffmpeg_opts "${mp4dest:-$dest}" <$stopfile
|
pid=$!
|
||||||
|
echo $pid >$stopfile
|
||||||
|
wait $pid
|
||||||
rm -f $stopfile
|
rm -f $stopfile
|
||||||
if [[ -f "$mp4dest" ]]; then
|
if [[ -f "$mp4dest" ]]; then
|
||||||
mov2gif "$mp4dest" "$dest" && rm -fv "$mp4dest"
|
mov2gif "$mp4dest" "$dest" && rm -fv "$mp4dest"
|
||||||
fi
|
fi
|
||||||
echo "$dest" | xclip -selection clipboard -in
|
echo -n "$dest" | xclip -selection clipboard -in
|
||||||
notify-send "Screencast successful" "Saved to $dest\nAnd copied to your clipboard!"
|
notify-send "Screencast successful" "Saved to $dest\nAnd copied to your clipboard!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# If a recording session is already active, stop that one.
|
# If a recording session is already active, stop that one.
|
||||||
if [[ $is_script && -f $stopfile ]]; then
|
if [[ -n "$is_script" && -f "$stopfile" ]]; then
|
||||||
echo q > $stopfile
|
kill $(cat $stopfile)
|
||||||
echo "Stopped previous recording"
|
echo "Stopped previous recording"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r W H X Y < <(select-region)
|
read -r W H X Y < <(select-region)
|
||||||
|
[[ -z "$W$H$X$Y" ]] && exit 1
|
||||||
|
|
||||||
# Compton with blur and/or transparencies cause unbearable flickering in
|
# Compton with blur and/or transparencies cause unbearable flickering in
|
||||||
# recordings, so temporarily disable it.
|
# recordings, so temporarily disable it.
|
||||||
|
|
Loading…
Reference in a new issue