diff --git a/autocompile.sh b/autocompile.sh index b8291ac..29a2599 100644 --- a/autocompile.sh +++ b/autocompile.sh @@ -14,7 +14,10 @@ cleanup_and_push() { git add *.tex *.py *.ipynb 2>/dev/null [ -f "$PDF_DOSYASI" ] && git add "$PDF_DOSYASI" 2>/dev/null # O anki tarih ve saat ile otomatik commit mesajı oluştur - git commit -m "Oto-Kayıt: $(date '+%Y-%m-%d %H:%M:%S')" + if git commit -m "Oto-Kayıt: $(date '+%Y-%m-%d %H:%M:%S')"; then + echo "📦 Bu commit'e giren dosyalar:" + git show --stat HEAD + fi if timeout 10 git push origin main; then echo "✅ Kodlar ve PDF sunucuya başarıyla işlendi!" else @@ -64,7 +67,12 @@ fi # 6. TEMPLATE CREATOR if [ ! -f "$TEX_DOSYASI" ]; then echo "📄 '$TEX_DOSYASI' not found. Creating template..." - cat << 'TEMPLATE' > "$TEX_DOSYASI" + # Dosya adından başlık üret: yolu ve .tex uzantısını at, alt çizgiyi boşluğa çevir + BASLIK="${TEX_DOSYASI##*/}" + BASLIK="${BASLIK%.tex}" + BASLIK="${BASLIK//_/ }" + # NOT: Bu heredoc tırnaksız ($BASLIK genişlesin diye). İçine $, ` ya da \\ eklemeyin. + cat << TEMPLATE > "$TEX_DOSYASI" \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} @@ -73,7 +81,7 @@ if [ ! -f "$TEX_DOSYASI" ]; then \usepackage{hyperref} \geometry{margin=0.1in} -\title{new paper side notes} +\title{$BASLIK paper side notes} \author{Demircan Demirbağ} \date{\today} @@ -99,16 +107,20 @@ if [ ! -f "$PDF_DOSYASI" ]; then exit 1 fi -# 8. OPEN PDF AND MAXIMIZE -evince "$PWD/$PDF_DOSYASI" > /dev/null 2>&1 & -sleep 2 -if command -v wmctrl > /dev/null; then - wmctrl -r "evince" -b add,maximized_vert,maximized_horz -elif command -v xdotool > /dev/null; then - xdotool search --name "evince" windowsize --sync 100% 100% -fi +# 8. OPEN PDF (FULLSCREEN, GENİŞLİĞE SIĞDIR) +# Evince tam ekranı kendisi istesin: wmctrl/xdotool kurulu olmasına ya da zamanlamaya bağlı değil. +# (Çıkmak için Esc veya F11) +# Varsayılan zoom modunu %100 yerine "genişliğe sığdır" yap. dconf/dbus olmayan Termux'ta +# ayar kaybolmasın diye keyfile backend kullanılıyor (~/.config/glib-2.0/settings/keyfile). +# NOT: Evince, daha önce açılmış bir PDF için kendi kaydettiği zoom'u kullanır (o dosyada bir kez +# yukarıdaki zoom menüsünden "Fit Width" seç, hatırlar). +GSETTINGS_BACKEND=keyfile gsettings set org.gnome.Evince.Default sizing-mode 'fit-width' 2>/dev/null +GSETTINGS_BACKEND=keyfile evince --fullscreen "$PWD/$PDF_DOSYASI" > /dev/null 2>&1 & # 9. TRIGGER ACODE +# Evince penceresi açılsın, sonra Acode öne gelsin (yoksa X11 Acode'un üstüne çıkabiliyor). +# Yine Acode'un arkasında kalıyorsa süreyi artır. +sleep 2 termux-open --content-type "text/x-tex" "$TEX_DOSYASI" echo "==============================================" @@ -117,7 +129,10 @@ echo "📂 Working Directory: $PWD" echo "==============================================" # 10. WATCH LOOP (Aynı bıraktık) -while inotifywait -q -e close_write --include '.*\.tex$' -r .; do +HEDEF_YOL="$(realpath -m "$TEX_DOSYASI")" +while DEGISEN=$(inotifywait -q -e close_write --format '%w%f' --include '.*\.tex$' -r .); do + # Sadece izlenen dosya kaydedildiyse derle, diğer .tex dosyalarını yoksay + [ "$(realpath -m "$DEGISEN")" = "$HEDEF_YOL" ] || continue echo "⏳ Saved. Compiling..." pdflatex -interaction=nonstopmode "$TEX_DOSYASI" > compile_log.txt 2>&1 if grep -q "^!" compile_log.txt; then