diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | bin/xsnap.sh | 24 | ||||
-rw-r--r-- | man/man1/xsnap.1df | 16 | ||||
-rw-r--r-- | sxhkd/sxhkdrc | 16 |
5 files changed, 51 insertions, 9 deletions
@@ -156,6 +156,7 @@ /bin/xgoc /bin/xrbg /bin/xrq +/bin/xsnap /dillo/dillorc /dillo/dillorc.m4 /emacs/bin/emacsm @@ -227,7 +227,8 @@ BINS = bin/ap \ bin/xgo \ bin/xgoc \ bin/xrbg \ - bin/xrq + bin/xrq \ + bin/xsnap BINS_M4 = bin/chn.m4 \ bin/dfv.m4 \ diff --git a/bin/xsnap.sh b/bin/xsnap.sh new file mode 100644 index 00000000..c4b2a9ea --- /dev/null +++ b/bin/xsnap.sh @@ -0,0 +1,24 @@ +# Wrapper for scrot(1) for use in recording screenshots +date=$(date +%Y/%m/%d) || exit +dir=$HOME/screenshots/scrot/$date +mkdir -p -- "$dir" || exit +cd -- "$dir" || exit +for ent in * ; do + [ -e "$ent" ] || continue + case $ent in + *.png) ;; + *) continue ;; + esac + basename=${ent%.png} + case $basename in + *[!0-9]*) continue ;; + esac + last=$basename +done +number=$(printf '%s' "$last" | sed 's/^0*//') # Avoid octal +id=$((number + 1)) +name=$(printf '%05d' "$id").png +path=$dir/$name +scrot --file="$path" --overwrite "$@" || exit +xclip -selection clipboard -target image/png "$path" || exit +notify-send "Saved: $date/$name" diff --git a/man/man1/xsnap.1df b/man/man1/xsnap.1df new file mode 100644 index 00000000..ff177754 --- /dev/null +++ b/man/man1/xsnap.1df @@ -0,0 +1,16 @@ +.TH XSNAP 1df "May 2022" "Manual page for xsnap" +.SH NAME +.B xsnap +\- wrapper around scrot(1) for serialized recorded screenshots +.SH SYNOPSIS +.B xsnap +.br +.B xsnap +\--select +.SH DESCRIPTION +.B xsnap +takes a PNG screenshot with scrot(1), passing any options thereto, saving the +image into a date-stamped path ~/screenshots/scrot/YYYY-MM-DD, with increasing +integer filenames for that day. +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc index 028b73d7..4322c5ff 100644 --- a/sxhkd/sxhkdrc +++ b/sxhkd/sxhkdrc @@ -31,14 +31,14 @@ super + p super + v x-terminal-emulator -e "$VISUAL" -super + shift + s - sleep 0.25 && scrot --freeze --select \ - --exec 'xclip -selection clipboard -target image/png $f && \ - dir=$$HOME/screenshots/%Y-%m-%d && \ - mkdir --parents -- "$$dir" && \ - convert -- $f -define webp:lossless=true \ - "$$dir"/%Y-%m-%d_%H%M%S_$wx$h.webp && \ - rm -- $f' +Print + xsnap + +control + Print + xsnap --freeze --select + +super + Print + xsnap --focused super + slash i3lock --color=#000000 --image "$HOME"/.local/share/i3/lock.png --nofork |