diff --git a/bin/bundle-appimage.sh b/bin/bundle-appimage.sh index 5120d1b..ab84aed 100755 --- a/bin/bundle-appimage.sh +++ b/bin/bundle-appimage.sh @@ -23,6 +23,24 @@ 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/ + +# Ghostty's build substitutes @GHOSTTY@ in app.desktop.in / dbus.service.in with the +# absolute path of the build prefix, and quick-sharun copies the entry into $APPDIR +# verbatim. Integration tools that extract the entry (e.g. appimaged) then get a +# TryExec that cannot exist, so the desktop environment hides it or fails to launch. +# Reset those paths to the binary name the README documents and drop DBus activation, +# which cannot work from an AppImage (quick-sharun removes DBusActivatable from the +# top level entry; the copy below would bring it back). +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|' \ + -e '/^DBusActivatable=/d' \ + "${desktop_file}" +done +rm -rf ./AppDir/share/dbus-1 + quick-sharun --make-appimage mkdir -p ./dist