From 57180cc51b5391382b65cdb0fb97a3b3b558a7a8 Mon Sep 17 00:00:00 2001 From: FeiLiuEM Date: Thu, 8 Oct 2026 08:55:09 +0800 Subject: [PATCH] fix(bundle): normalize Exec/TryExec in the embedded desktop entries zig build substitutes @GHOSTTY@ in dist/linux/app.desktop.in with the absolute build prefix, and bundle-appimage.sh copies zig-out/share/* into AppDir/share verbatim (quick-sharun copies the same file to the AppDir root), so the entries shipped inside the image point at /__w/ghostty-appimage/ghostty-appimage/ghostty-/zig-out/bin/ghostty. Integration tools rewrite Exec/TryExec when they install the entry, so this is not user-visible breakage for them; normalize it anyway so the entry that ships inside the image is portable on its own, using the binary name the README documents. This is what the repo's own assets/ghostty.desktop did before 98e5a30. Only the Exec/TryExec lines of the embedded entries are touched: DBusActivatable and share/dbus-1 are left as they are (quick-sharun handles the AppDir root entry, and the tools' rewriting behaviour means nothing depends on the rest). Verified against the files extracted from the current tip AppImage (Ghostty-1.3.2-main+a4aacd9, sha256 0ff324551791220ec4a5d41cb562e7f2b272559cfb2c4ff0288a81c911939a57): both entries become TryExec=ghostty / Exec=ghostty --gtk-single-instance=true (new-window action included), desktop-file-validate is clean, shellcheck --severity=warning --shell=sh and shfmt -s -d pass. Refs #168 --- bin/bundle-appimage.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/bundle-appimage.sh b/bin/bundle-appimage.sh index 5120d1b..52bcd6e 100755 --- a/bin/bundle-appimage.sh +++ b/bin/bundle-appimage.sh @@ -23,6 +23,22 @@ export ICON="./ghostty-${GHOSTTY_VERSION}/zig-out/share/icons/hicolor/256x256/ap quick-sharun ./ghostty-${GHOSTTY_VERSION}/zig-out/bin/ghostty cp -rf ./ghostty-${GHOSTTY_VERSION}/zig-out/share/* ./AppDir/share/ + +# zig build substitutes @GHOSTTY@ in dist/linux/app.desktop.in with the absolute build +# prefix, and the copy above drops the generated tree into AppDir verbatim, so the +# embedded entries carry a build path such as +# /__w/ghostty-appimage/ghostty-appimage/ghostty-/zig-out/bin/ghostty. +# Integration tools (AM, GearLever, Soar, AppImageLauncher) rewrite Exec/TryExec when they +# install the entry, so this is not user-visible breakage for them; normalize it anyway so +# the entry shipped inside the image is portable on its own. +for desktop_file in ./AppDir/*.desktop ./AppDir/share/applications/*.desktop; do + [ -f "${desktop_file}" ] || continue + sed -i -E \ + -e 's|^Exec=[^ ]*/|Exec=|' \ + -e 's|^TryExec=.*|TryExec=ghostty|' \ + "${desktop_file}" +done + quick-sharun --make-appimage mkdir -p ./dist