Update screenprint2.sh

This commit is contained in:
FURK4NGG
2026-03-15 16:46:50 +03:00
committed by GitHub
parent 6cbf6257e5
commit c7cf186126
+22
View File
@@ -115,7 +115,29 @@ take_selection() {
elif command -v scrot >/dev/null 2>&1; then
local file="$DIR/secili-alan-$(date +%Y%m%d-%H%M%S).png"
scrot -s "$file"
if [ ! -f "$file" ]; then
exit 0
fi
if command -v identify >/dev/null 2>&1; then
local size w h
size="$(identify -format "%w %h" "$file" 2>/dev/null || true)"
w="${size%% *}"
h="${size##* }"
case "$w" in ''|*[!0-9]*) w=999 ;; esac
case "$h" in ''|*[!0-9]*) h=999 ;; esac
if [ "$w" -le 5 ] || [ "$h" -le 5 ]; then
notify_ok "Selected Screen"
else
notify_ok "Selected Area"
fi
else
notify_ok "Selected Area"
fi
printf '%s\n' "$file"
else
echo "No working area screenshot tool found (need grim+slurp or scrot)" >&2