Files
imajviewer/install.sh
Alhan 4dae4234ba
Some checks failed
Build Windows / build-windows (push) Has been cancelled
feat: letterbox-aware clamp, full-frame image, fit/fill zoom fix
- image_canvas.dart:
  - Fill mod: viewport tabanli clamp (_tx=0'da kilit)
  - Fit mod: RenderBox ile resmin gercek render boyutuna gore clamp
  - Letterbox offset (offX/offY) hesaba katilarak resmin kenarlarina kadar pan
  - Zoom-to-cursor dogru calisiyor (alignment: topLeft ile)
  - Min scale 1.0 (her iki modda da)
  - Overflow durumunda lo/hi reversed clamp (goruntu disari kacmaz)
- viewer_screen.dart: image alani top:24 -> top:0 (tam cerceve)
- install.sh: release -> debug bundle path (gelistirme)
2026-07-24 06:22:59 +03:00

112 lines
4.1 KiB
Bash
Executable File
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
APP=imajviewer
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BUNDLE_DIR="${SCRIPT_DIR}/build/linux/x64/debug/bundle"
INSTALL_DIR="${HOME}/.local/lib/${APP}"
BIN_LINK="${HOME}/.local/bin/${APP}"
DESKTOP_FILE="${HOME}/.local/share/applications/${APP}.desktop"
ICON_DIR="${HOME}/.local/share/icons/hicolor/64x64/apps"
ICON_FILE="${ICON_DIR}/${APP}.png"
# ── Renkler ──
RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'; NC='\033[0m'
info() { echo -e "${CYAN}${NC} $1"; }
ok() { echo -e "${GREEN}${NC} $1"; }
err() { echo -e "${RED}${NC} $1"; exit 1; }
# ── Ön koşul kontrol ──
command -v xdg-mime >/dev/null 2>&1 || err "xdg-mime bulunamadı (xdg-utils paketi gerekli)"
command -v xdg-desktop-menu >/dev/null 2>&1 || err "xdg-desktop-menu bulunamadı (xdg-utils paketi gerekli)"
if [ ! -f "$BUNDLE_DIR/${APP}" ]; then
# Önce release/ dizininde hazır binary var mı kontrol et
RELEASE_DIR="${SCRIPT_DIR}/release"
if [ -f "$RELEASE_DIR/${APP}" ]; then
info "Hazır binary bulundu: release/"
BUNDLE_DIR="$RELEASE_DIR"
else
info "Binary bulunamadı, Flutter build başlatılıyor…"
cd "$SCRIPT_DIR"
flutter build linux --debug 2>&1 | tail -1 || err "Flutter build başarısız! Sistemde Flutter SDK yoksa önce git clone yapıp './install.sh' çalıştırın."
BUNDLE_DIR="${SCRIPT_DIR}/build/linux/x64/debug/bundle"
[ -f "$BUNDLE_DIR/${APP}" ] || err "Build başarısız!"
fi
fi
# ── Kurulum dizinleri ──
mkdir -p "$INSTALL_DIR" "$(dirname "$BIN_LINK")" "$(dirname "$DESKTOP_FILE")" "$ICON_DIR"
# ── Binary + kütüphaneler ──
info "Binary ve kütüphaneler kopyalanıyor…"
cp -r "$BUNDLE_DIR"/* "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/${APP}"
# ── Symlink ──
ln -sf "$INSTALL_DIR/${APP}" "$BIN_LINK"
ok "Symlink: $BIN_LINK$INSTALL_DIR/${APP}"
# ── İkon (64×64 PNG) ──
if [ ! -f "$ICON_FILE" ]; then
info "İkon oluşturuluyor…"
python3 -c "
import struct, zlib, sys
w=h=64; r=g=b=0xff
raw=b''
for y in range(h):
raw+=b'\\x00'
for x in range(w):
d=abs(x-32)+abs(y-32)
if d<24: r,g,b=100,140,255
elif d<30: r,g,b=200,220,255
else: r,g,b=40,45,50
raw+=bytes([r,g,b,255])
def c(t,d):
c=t+d
return struct.pack('>I',len(d))+c+struct.pack('>I',zlib.crc32(c)&0xffffffff)
with open('$ICON_FILE','wb') as f:
f.write(b'\\x89PNG\\r\\n\\x1a\\n')
f.write(c(b'IHDR',struct.pack('>IIBBBBB',w,h,8,6,0,0,0)))
f.write(c(b'IDAT',zlib.compress(raw)))
f.write(c(b'IEND',b''))
print(' İkon: $ICON_FILE')
"
fi
ok "İkon hazır"
# ── .desktop dosyası ──
info ".desktop dosyası oluşturuluyor…"
cat > "$DESKTOP_FILE" << EOF
[Desktop Entry]
Type=Application
Name=${APP}
Comment=Ultra hafif görüntü izleyici
Exec=${BIN_LINK} %F
Icon=${APP}
Terminal=false
Categories=Graphics;Viewer;RasterGraphics;
MimeType=image/png;image/jpeg;image/webp;image/bmp;image/gif;image/jpg;
StartupNotify=false
EOF
ok "${DESKTOP_FILE}"
# ── MIME default ──
info "Varsayılan görüntü izleyici olarak ayarlanıyor…"
for mime in image/png image/jpeg image/jpg image/webp image/bmp image/gif; do
xdg-mime default "${APP}.desktop" "$mime" 2>/dev/null || true
done
# ── Masaüstü veritabanını güncelle ──
which update-desktop-database &>/dev/null && update-desktop-database "${HOME}/.local/share/applications/" 2>/dev/null || true
which gtk-update-icon-cache &>/dev/null && gtk-update-icon-cache "${HOME}/.local/share/icons/hicolor/" 2>/dev/null || true
echo ""
echo -e "${GREEN}══════════════════════════════════════════${NC}"
echo -e "${GREEN} ${APP} kuruldu!${NC}"
echo -e "${GREEN} Bir PNG/JPG/WebP dosyasına çift tıklayın${NC}"
echo -e "${GREEN} veya 'xdg-open <dosya>' ile test edin${NC}"
echo -e "${GREEN}══════════════════════════════════════════${NC}"
echo ""
echo "Kaldırmak için: rm -rf ${INSTALL_DIR} ${BIN_LINK} ${DESKTOP_FILE} ${ICON_FILE}"