Fix screenshot/cast scripts

This commit is contained in:
Henrik Lissner 2020-02-08 23:26:11 -05:00
parent 8616ae118a
commit 90dec2e245
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 12 additions and 9 deletions

View file

@ -4,13 +4,14 @@
# Uses ffmpeg to convert a video file to a gif file. Optimizes the final result
# with gifsicle.
#
# Requires: ffmpeg
# Optional: gifsicle
# Requires: ffmpeg gifsicle
#
# Example:
# vid2gif some-vid.mp4 output.gif
# vid2gif -f 10 -s 00:00:10 -t 00:00:05 some-vid.mp4 output.gif
shift # Get rid of extraneous nix-shell argument
set -e
PALETTE="/tmp/palette.png"

View file

@ -11,7 +11,7 @@ trap cleanup EXIT
# Delay for long enough that we can refocus the targeted window
if maim --delay=${2:-1} -us >"$tmp"; then
xclip -selection clipboard -t image/png "$tmp" &&
notify-send "Screenshot saved"
notify-send "Screenshot saved" "Copied image to clipboard"
else
notify-send -u low "Aborted screenshot"
fi

View file

@ -10,6 +10,8 @@
# Usage: scrrec somefile.mp4
# scrrec another.gif
shift # Get rid of extraneous nix-shell argument
is_script=
geom=
delay=1
@ -41,16 +43,16 @@ countdown() {
if (( count > 0 )); then
for ((i=count;i>0;i--)); do
if [[ $is_script ]]; then
echo "Recording in $i"
else
notify-send -u critical -t 1000 "Recording in $i"
else
echo "Recording in $i"
fi
sleep 1
done
elif [[ $is_script ]]; then
echo "Started recording..."
else
notify-send -u critical "Starting recording..."
else
echo "Started recording..."
fi
}
@ -67,7 +69,7 @@ recording-start() {
mov2gif "$mp4dest" "$dest" && rm -fv "$mp4dest"
fi
echo "$dest" | xclip -selection clipboard -in
notify-send "Screencast saved to $dest" "Copied to clipboard!"
notify-send "Screencast successful" "Saved to $dest\nAnd copied to your clipboard!"
}
@ -91,6 +93,6 @@ cleanup() { [[ $compton ]] && systemctl --user start compton; }
trap cleanup EXIT
# Let 'er rip
recording-start "$dest" "$X" "$Y" "$W" "$H"
recording-start "$1" "$X" "$Y" "$W" "$H"
# vim:set ft=sh shiftwidth=2: