Skip to content

fix(bundle): reset desktop entry paths and drop D-Bus activation files - #169

Closed
FeiLiuEM wants to merge 1 commit into
pkgforge-dev:mainfrom
FeiLiuEM:fix/bundle-desktop-entry-paths
Closed

FeiLiuEM wants to merge 1 commit into
pkgforge-dev:mainfrom
FeiLiuEM:fix/bundle-desktop-entry-paths

Conversation

@FeiLiuEM

@FeiLiuEM FeiLiuEM commented Oct 7, 2026

Copy link
Copy Markdown

What & why

The AppImage ships a desktop entry whose Exec/TryExec point at the CI build directory, plus a D-Bus service file with the same path and DBusActivatable=true:

$ ./Ghostty-1.3.2-main+a4aacd9-x86_64.AppImage --appimage-extract >/dev/null
$ grep -rn '/__w/' squashfs-root/ | cut -c1-120
squashfs-root/com.mitchellh.ghostty.desktop:6:TryExec=/__w/ghostty-appimage/…
squashfs-root/share/applications/com.mitchellh.ghostty.desktop:6:TryExec=/__w/…
squashfs-root/share/dbus-1/services/com.mitchellh.ghostty.service:4:Exec=/__w/…

Cause chain:

  1. Upstream dist/linux/app.desktop.in / dbus.service.in use @GHOSTTY@, which zig build substitutes with the absolute build prefix (inside CI: /__w/ghostty-appimage/ghostty-appimage/ghostty-<ver>/zig-out/bin/ghostty).
  2. bundle-appimage.sh passes that generated file as DESKTOP=…; quick-sharun copies it into $APPDIR verbatim and only strips DBusActivatable.
  3. bundle-appimage.sh then does cp -rf ./ghostty-<ver>/zig-out/share/* ./AppDir/share/ after quick-sharun, which re-adds the unsanitized entry (share/applications/…desktop, still DBusActivatable=true) and adds share/dbus-1/services/…service.

Integration tools that extract the embedded entry (appimaged, or a manual copy into ~/.local/share/applications/) therefore get a TryExec that cannot exist, and KDE/GNOME hide the entry or fail to launch it — the symptom in #127, which is still reproducible on the current tip build.

The change

After that cp, rewrite the absolute paths to the binary name the README documents (install ./Ghostty-*.AppImage $HOME/.local/bin/ghostty), remove DBusActivatable (quick-sharun deliberately strips it from the top level entry; the copy brought it back) and don't ship the unusable dbus-1 service file.

Verification

Ran the new block against the files extracted from the current tip AppImage (Ghostty-1.3.2-main+a4aacd9-x86_64, sha256 0ff324551791220ec4a5d41cb562e7f2b272559cfb2c4ff0288a81c911939a57):

before: TryExec=/__w/…/zig-out/bin/ghostty            after: TryExec=ghostty
        Exec=/__w/…/zig-out/bin/ghostty --gtk-…                Exec=ghostty --gtk-single-instance=true   (both entries, new-window action included)
        share/applications/…desktop: DBusActivatable=true      (line removed)
        share/dbus-1/services/…service: Exec=/__w/…            (directory removed)
desktop-file-validate: clean on both entries
shellcheck --severity=warning --shell=sh bin/bundle-appimage.sh: clean
shfmt -d -s bin/bundle-appimage.sh: no diff

I did not run the full CI build (needs the Arch container); the patch only touches files that are already in AppDir at that point, and the transformation above is exactly what runs there.

Fixes #168. Happy to follow up with a guard in repo-management.sh validate-appimage (grep -q '/__w/' on the embedded entry → fail) if you want the regression covered by CI as well.

Ghostty's build substitutes @GhostTy@ in dist/linux/app.desktop.in and
dist/linux/dbus.service.in with the absolute path of the build prefix, so the
desktop entry shipped in the AppImage points at
/__w/ghostty-appimage/ghostty-appimage/ghostty-<ver>/zig-out/bin/ghostty.

quick-sharun copies that entry into $APPDIR verbatim (stripping only
DBusActivatable), and bundle-appimage.sh then copies zig-out/share/* into
AppDir/share after quick-sharun ran, which brings the unsanitized entry back
together with a dbus-1 service file aimed at the build machine.

Any tool that extracts the embedded entry (appimaged, or a manual copy into
~/.local/share/applications/) gets a TryExec that cannot exist, so the desktop
environment hides the entry or fails to launch it (pkgforge-dev#127).

Rewrite Exec/TryExec to the binary name the README documents
(install ./Ghostty-*.AppImage $HOME/.local/bin/ghostty), drop DBusActivatable
and do not ship the unusable dbus-1 service file.

Verified against the files extracted from the current tip AppImage
(Ghostty-1.3.2-main+a4aacd9, sha256 0ff324551791220ec4a5d41cb562e7f2b272559cfb2c4ff0288a81c911939a57):
both entries end up as 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 pkgforge-dev#168
@Samueru-sama

Copy link
Copy Markdown
Member

@FeiLiuEM

FeiLiuEM commented Oct 8, 2026

Copy link
Copy Markdown
Author

Withdrawing this: the DBus part is already handled by quick-sharun for the entry that matters, and my impact claim did not hold (see the analysis in #168). I may follow up with a minimal Exec/TryExec-only patch if the second desktop copy in the image turns out to be unintentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tip AppImage still ships CI build paths in .desktop/.service (regression of #127)

2 participants