alqueva/hosts/python/users/configs/river/scripts/screenshot.sh
2025-01-08 10:56:55 +00:00

38 lines
590 B
Bash
Executable file

#!/usr/bin/env bash
# shellcheck disable=SC1091
source "$HOME/.config/user-dirs.dirs"
case "$1" in
"copy")
GEOM="$(slurp)"
if [ "$GEOM" == "" ]; then
grim - | wl-copy
else
grim -g "$GEOM" - | wl-copy
fi
echo "Screenshot copied."
;;
"save")
GEOM="$(slurp)"
if [ "$GEOM" == "" ]; then
grim "$OUT"
else
grim -g "$GEOM" "$OUT"
fi
echo "Screenshot saved. $OUT"
;;
"savecopy")
GEOM="$(slurp)"
if [ "$GEOM" == "" ]; then
grim - | wl-copy
else
grim -g "$GEOM" - | wl-copy
fi
wl-copy <"$OUT"
echo "Screenshot saved and copied. $OUT"
;;
*)
echo "Not done!"
;;
esac