Skip to content

fix(desktop): stop AppImage executable name ending in .desktop - #58263

Merged
Hona merged 1 commit into
anomalyco:devfrom
ImBIOS:fix-appimage-executable-name
Oct 23, 2026
Merged

Hona merged 1 commit into
anomalyco:devfrom
ImBIOS:fix-appimage-executable-name

Conversation

@ImBIOS

@ImBIOS ImBIOS commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #51867

Problem

The prod AppImage ships its main ELF executable (~228 MB) named ai.opencode.desktop, with the real desktop entry alongside it as ai.opencode.desktop.desktop. libappimage (used by AppImageLauncher) resolves the desktop entry by globbing *.desktop at the squashfs root, picks the ELF, and fails:

ERROR: appimage_shall_not_be_integrated : Unexpected char '�' at 0
ERROR: appimage_register_in_system : Malformed desktop entry: Unexpected char '�' at 0

(0x7F is 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 with KConfigIni ... Invalid entry warnings.

Fix

  • linux.executableName now strips a trailing .desktop (prod: ai.opencode.desktop -> ai.opencode; beta/dev appIds end in .beta/.dev and are unchanged).
  • linux.syncDesktopName: true so the installed .desktop filename still derives from desktopName (ai.opencode.desktop.desktop for prod) — StartupWMClass, icon references, and window association are unchanged.
  • Legacy hidden launcher opencode-desktop.desktop updated 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.
  • Built the real prod AppImage and extracted it: exactly one *.desktop match (ai.opencode.desktop.desktop, valid INI); ELF is now ai.opencode; icon is ai.opencode.png matching Icon=ai.opencode.
  • ail-cli integrate (appimagelauncher 3.0.0-beta-2) on the fixed AppImage succeeds and writes a correct launcher with StartupWMClass=ai.opencode.desktop; the unfixed 2.1.3 AppImage fails with the errors above.

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.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Hona
Hona enabled auto-merge (squash) October 22, 2026 23:58
@Hona
Hona disabled auto-merge October 22, 2026 23:58
@Hona
Hona merged commit 91a7fe5 into anomalyco:dev Oct 23, 2026
13 checks passed
@ImBIOS
ImBIOS deleted the fix-appimage-executable-name branch October 23, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

desktop/appimage: ELF binary named "ai.opencode.desktop" spams KDE Plasma with KConfigIni warnings

2 participants