Skip to content

fix(bundle): normalize Exec/TryExec in the embedded desktop entries - #170

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

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

Conversation

@FeiLiuEM

@FeiLiuEM FeiLiuEM commented Oct 8, 2026

Copy link
Copy Markdown

Follow-up to #168 — the DBus-related parts of my first attempt (#169, closed) were wrong, and Samueru-sama's reply was right: quick-sharun already strips DBusActivatable for the entry that matters, and every integration tool rewrites Exec/TryExec when it installs the entry (AM, GearLever, Soar, AppImageLauncher). I am not claiming any user-visible breakage here.

What this PR does (and nothing else): normalize the absolute build path that the entries shipped inside the image carry.

Upstream dist/linux/app.desktop.in uses the @GHOSTTY@ placeholder, and zig build substitutes it with the absolute build prefix. bundle-appimage.sh copies ghostty-<ver>/zig-out/share/* into AppDir/share/ (quick-sharun copies the same file to the AppDir root), so both entries end up with:

TryExec=/__w/ghostty-appimage/ghostty-appimage/ghostty-<ver>/zig-out/bin/ghostty
Exec=/__w/ghostty-appimage/ghostty-appimage/ghostty-<ver>/zig-out/bin/ghostty --gtk-single-instance=true

The change rewrites those two keys to the binary name the README documents (install ./Ghostty-*.AppImage $HOME/.local/bin/ghostty), so the entry that ships inside the image is portable on its own. This is also what the repo's own assets/ghostty.desktop did before 98e5a30 ("chore: restructure project") switched to consuming upstream's generated file.

Deliberately not touched (the mistakes of #169):

  • DBusActivatable — quick-sharun handles the AppDir root entry.
  • share/dbus-1/services/com.mitchellh.ghostty.service — left in place.

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 → AppDir/com.mitchellh.ghostty.desktop:            TryExec=/__w/…, Exec=/__w/… --gtk-single-instance=true
after  →                                                  TryExec=ghostty, Exec=ghostty --gtk-single-instance=true
before → AppDir/share/applications/com.mitchellh.ghostty.desktop: same paths (+ DBusActivatable=true)
after  →                                                  same rewrite, DBusActivatable left as shipped
[Desktop Action new-window] Exec= is rewritten as well (the sed applies per line)
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

The full CI build container was not run locally; the patch only edits files that already exist in AppDir at that point.

If you'd rather not carry this at all, say so and I'll close it — as established in #168, nothing depends on it.

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-<ver>/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 pkgforge-dev#168
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.

1 participant