Repository navigation
fix(desktop): stop AppImage executable name ending in .desktop - #58263
Conversation
libappimage resolves the desktop entry inside an AppImage by globbing *.desktop at the squashfs root. With executableName set to the prod appId (ai.opencode.desktop), the ELF binary matches that glob and integration fails with Malformed desktop entry: Unexpected char 0x7f at 0. Strip a trailing .desktop from the executable name (prod: ai.opencode) and derive the installed .desktop filename from desktopName via linux.syncDesktopName so window association is unchanged.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
There was a problem hiding this comment.
Looks good. I built a prod AppImage from a stubbed prepackaged app on both the base and this branch and extracted it. On the base, the ELF ai.opencode.desktop and ai.opencode.desktop.desktop both match *.desktop. With this change, only the real entry matches, and it keeps StartupWMClass=ai.opencode.desktop with an Icon=ai.opencode that matches the bundled icon. Reading electron-builder's source, syncDesktopName: true keeps the installed .desktop file name (and the AppStream launchable) the same for all channels. bun test electron-builder.config.test.ts passes and tsc -b is clean.
Public API: unchanged (no SDK, server, plugin, config or CLI changes). One user-visible change in the Linux packages: prod deb/rpm now install /opt/OpenCode/ai.opencode and the /usr/bin/ai.opencode symlink (previously ai.opencode.desktop), and the AppArmor profile and hicolor icon names follow. Upgrades handle this because the old package's scripts remove the old names, but anyone running ai.opencode.desktop from a script or custom launcher will need to update it. Beta and dev are unaffected.
No blocking concerns.
Fixes #51867
Problem
The prod AppImage ships its main ELF executable (~228 MB) named
ai.opencode.desktop, with the real desktop entry alongside it asai.opencode.desktop.desktop. libappimage (used by AppImageLauncher) resolves the desktop entry by globbing*.desktopat the squashfs root, picks the ELF, and fails:(
0x7Fis the first byte of the ELF magic.) Result: "Failed to register AppImage in system via libappimage", no menu entry. Same root cause also spams KDE Plasma withKConfigIni ... Invalid entrywarnings.Fix
linux.executableNamenow strips a trailing.desktop(prod:ai.opencode.desktop->ai.opencode; beta/dev appIds end in.beta/.devand are unchanged).linux.syncDesktopName: trueso the installed.desktopfilename still derives fromdesktopName(ai.opencode.desktop.desktopfor prod) —StartupWMClass, icon references, and window association are unchanged.opencode-desktop.desktopupdated to the new binary path (Exec=/opt/OpenCode/ai.opencode) and icon basename (Icon=ai.opencode).Verification
bun test electron-builder.config.test.ts: 7 pass (added regression invariant: executable never ends in.desktop).bun run typecheck: clean.*.desktopmatch (ai.opencode.desktop.desktop, valid INI); ELF is nowai.opencode; icon isai.opencode.pngmatchingIcon=ai.opencode.ail-cli integrate(appimagelauncher 3.0.0-beta-2) on the fixed AppImage succeeds and writes a correct launcher withStartupWMClass=ai.opencode.desktop; the unfixed 2.1.3 AppImage fails with the errors above.