Add files via upload
This commit is contained in:
+52
-5
@@ -15,12 +15,60 @@ MODE="$1"
|
||||
case "$MODE" in
|
||||
|
||||
image)
|
||||
GEOM=$(slurp) || exit 0
|
||||
IMG="$IMG_DIR/capture_$(date +%s).png"
|
||||
GEOM="$(slurp 2>/dev/null || true)"
|
||||
[ -z "$GEOM" ] && exit 0
|
||||
|
||||
grim -g "$GEOM" "$IMG"
|
||||
POS_PART="${GEOM%% *}"
|
||||
SIZE_PART="${GEOM#* }"
|
||||
|
||||
X="${POS_PART%,*}"
|
||||
Y="${POS_PART#*,}"
|
||||
W="${SIZE_PART%x*}"
|
||||
H="${SIZE_PART#*x}"
|
||||
|
||||
case "$X" in ''|*[!0-9]*) exit 0 ;; esac
|
||||
case "$Y" in ''|*[!0-9]*) exit 0 ;; esac
|
||||
case "$W" in ''|*[!0-9]*) exit 0 ;; esac
|
||||
case "$H" in ''|*[!0-9]*) exit 0 ;; esac
|
||||
|
||||
# Tek tıklama -> tıklanan monitörün tamamı
|
||||
if [ "$W" -le 5 ] || [ "$H" -le 5 ]; then
|
||||
IMG="$IMG_DIR/tam-ekran-$(date +%Y%m%d-%H%M%S).png"
|
||||
|
||||
MON_GEOM="$(
|
||||
hyprctl monitors -j 2>/dev/null | python3 -c '
|
||||
import sys, json
|
||||
|
||||
x = int(sys.argv[1])
|
||||
y = int(sys.argv[2])
|
||||
|
||||
try:
|
||||
mons = json.load(sys.stdin)
|
||||
except Exception:
|
||||
sys.exit(1)
|
||||
|
||||
for m in mons:
|
||||
mx = int(m.get("x", 0))
|
||||
my = int(m.get("y", 0))
|
||||
mw = int(m.get("width", 0))
|
||||
mh = int(m.get("height", 0))
|
||||
|
||||
if mx <= x < mx + mw and my <= y < my + mh:
|
||||
print(f"{mx},{my} {mw}x{mh}")
|
||||
sys.exit(0)
|
||||
|
||||
sys.exit(1)
|
||||
' "$X" "$Y"
|
||||
)"
|
||||
|
||||
[ -z "$MON_GEOM" ] && exit 0
|
||||
|
||||
grim -g "$MON_GEOM" "$IMG"
|
||||
else
|
||||
IMG="$IMG_DIR/secili-alan-$(date +%Y%m%d-%H%M%S).png"
|
||||
grim -g "$GEOM" "$IMG"
|
||||
fi
|
||||
|
||||
# 🔥 SADECE IMAGE GÖNDER
|
||||
python "$HOME/capture-ai/ui.py" "$IMG"
|
||||
;;
|
||||
|
||||
@@ -34,4 +82,3 @@ case "$MODE" in
|
||||
echo " capture-ai.sh text"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user