1
0
Fork 0
dotfiles/.local/bin/grimsatty

14 lines
464 B
Bash
Executable File

#!/bin/zsh
# take screenshot with grimshot, annotate with satty, convert with cwebp
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
local what=${1:-area}
local tmpfile="$(mktemp --suffix='.grimsatty.png')"
local outfile="$(xdg-user-dir PICTURES)"/screenshots/$(date +screenshot_%FT%R:%S.webp)
grimshot save ${what} - \
| satty --filename - --output-filename ${tmpfile} --early-exit
cwebp -z 9 -m 6 -lossless -short ${tmpfile} -o ${outfile}
rm ${tmpfile}