From 90dec2e245fe56c9ed1d0ee4f85e6241ac0855f9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 8 Feb 2020 23:26:11 -0500 Subject: [PATCH] Fix screenshot/cast scripts --- bin/mov2gif | 5 +++-- bin/scrcap | 2 +- bin/scrrec | 14 ++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bin/mov2gif b/bin/mov2gif index 5e5904a3..fa4b7b45 100755 --- a/bin/mov2gif +++ b/bin/mov2gif @@ -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" diff --git a/bin/scrcap b/bin/scrcap index 6a2284b0..c5739e8d 100755 --- a/bin/scrcap +++ b/bin/scrcap @@ -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 diff --git a/bin/scrrec b/bin/scrrec index 2aa0c8e4..8d3a328e 100755 --- a/bin/scrrec +++ b/bin/scrrec @@ -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: