Files
capture-ai/screenprint2.sh
T
2026-03-15 13:35:07 +03:00

55 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
DIR="$HOME/Resimler"
mkdir -p "$DIR"
ARG="${1:-}"
notify_ok() {
if command -v notify-send >/dev/null 2>&1; then
notify-send "Screenshot taken" "$1"
fi
}
take_fullscreen() {
local file="$DIR/tam-ekran-$(date +%Y%m%d-%H%M%S).png"
grim "$file"
notify_ok "All Screens"
printf '%s\n' "$file"
}
take_selection_or_click() {
local geom file
geom="$(slurp 2>/dev/null || true)"
# kullanıcı iptal ettiyse sessiz çık
[ -z "$geom" ] && exit 0
# küçük seçimleri de direkt seçili alan gibi kaydet
file="$DIR/secili-alan-$(date +%Y%m%d-%H%M%S).png"
grim -g "$geom" "$file"
notify_ok "Selected Area"
printf '%s\n' "$file"
}
case "$ARG" in
"")
take_fullscreen
;;
only-one)
take_selection_or_click
;;
-h|--help|help|-help)
echo "Kullanim/Usage:"
echo " $0 -> Take screenshot for all screens"
echo " $0 only-one -> Select area and save it"
;;
*)
echo "Kullanim/Usage:"
echo " $0 -> Take screenshot for all screens"
echo " $0 only-one -> Select area and save it"
exit 1
;;
esac