alqueva/hosts/python/configs/river/scripts/screenshot.sh

39 lines
590 B
Bash
Raw Normal View History

2024-12-13 20:44:36 +00:00
#!/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