Skip to content

fix(desktop): restore linux launcher identity#31709

Merged
Hona merged 1 commit into
anomalyco:devfrom
neriousy:feat/desktop-linux-icon-identity
Jun 10, 2026
Merged

fix(desktop): restore linux launcher identity#31709
Hona merged 1 commit into
anomalyco:devfrom
neriousy:feat/desktop-linux-icon-identity

Conversation

@neriousy

@neriousy neriousy commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #31710

Regression context: #31571

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Restores the Linux desktop package identity after the Electron 42 packaging update in #31571 changed the installed executable, launcher, and icon basename to opencode-desktop.

The previous PR added opencode-desktop to avoid electron-builder deriving an invalid AppImage executable name from the scoped npm package name @opencode-ai/desktop. This keeps the same path-safety property, but uses the channel app id (ai.opencode.desktop, ai.opencode.desktop.beta, or ai.opencode.desktop.dev) so Linux desktop metadata lines up with the app id, desktopName, StartupWMClass, and hicolor icon basename.

For prod, the visible launcher is ai.opencode.desktop.desktop and references Icon=ai.opencode.desktop, so GNOME/KDE can associate the running Electron window with the installed launcher/icon.

This also ships a hidden compatibility launcher at opencode-desktop.desktop for prod deb/rpm packages. Existing Linux dock pins that point at the short-lived opencode-desktop.desktop entry should keep launching the app while new installs use the canonical app id launcher.

How did you verify your code works?

  • cd packages/desktop && bun test electron-builder.config.test.ts
  • cd packages/desktop && bun typecheck
  • cd packages/desktop && OPENCODE_CHANNEL=prod bunx electron-builder --linux deb --config electron-builder.config.ts --publish never
  • cd packages/desktop && OPENCODE_CHANNEL=prod bunx electron-builder --linux AppImage --config electron-builder.config.ts --publish never
  • Inspected the generated .deb and confirmed it contains:
    • /usr/share/applications/ai.opencode.desktop.desktop
    • /usr/share/applications/opencode-desktop.desktop
    • /usr/share/icons/hicolor/.../apps/ai.opencode.desktop.png
  • Pre-push hook ran bun turbo typecheck successfully.

Screenshots / recordings

N/A - packaging metadata change only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@neriousy neriousy marked this pull request as draft June 10, 2026 15:08
@neriousy neriousy marked this pull request as ready for review June 10, 2026 15:09

@Hona Hona left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the packaging mechanics against the vendored app-builder-lib 26.15.2 source. The identity alignment (executableName / desktopName / StartupWMClass / icon basename) is correct and the compat launcher matches what electron-builder generates for prod (/opt/${sanitizedProductName}/${executableName}). No bugs found. One decision to confirm before merge (beta pins, inline) and two optional notes.

protocols: { name: "OpenCode", schemes: ["opencode"] },
publish: { provider: "github", owner: "anomalyco", repo: "opencode", channel: "latest" },
rpm: { packageName: "opencode" },
deb: { fpm: [legacyDesktopEntryFpm] },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The compat launcher is prod-only, but the regression also affected beta: the regressed executableName: "opencode-desktop" was shared across all channels, and the deb/rpm launcher filename falls back to executableName, so regressed beta packages also installed /usr/share/applications/opencode-desktop.desktop. Beta users who pinned during the regression window will lose their pins on upgrade.

This may well be an acceptable tradeoff (short window, small audience, and a beta compat file would need a different Exec/opt/OpenCode Beta/ai.opencode.desktop.beta — while colliding with prod's compat file at the same path, a conflict the regressed packages already had). If it's intentional, worth a sentence in the PR description; otherwise beta needs its own legacy entry.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Resolved: maintainer decision is that launcher pin continuity is out of scope — no migration needed for beta (or anywhere). Not blocking merge. Optional follow-up: since pin migration is the compat launcher's only purpose, the opencode-desktop.desktop resource, the two fpm mappings, and the compat test could be dropped entirely to simplify the config — fine either way.

icon: `resources/icons`,
category: "Development",
executableName: "opencode-desktop",
executableName: appId,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Optional hardening: the installed .desktop filename here comes from executableName only because linux.syncDesktopName defaults to false — the identity holds because executableName === appId and desktopName === appId + ".desktop" happen to agree. Setting linux.syncDesktopName: true derives the launcher filename from desktopName directly, which is the pattern the 26.15.x docs recommend, and app-builder-lib notes the default flips to true in v27 anyway. Same output today; just removes the implicit coupling. (Relatedly, the explicit StartupWMClass below is already the 26.15.x default when desktopName is set — harmless, fine to keep as documentation.)

const module = await import(`./electron-builder.config.ts?channel=${channel.channel}`)
const config = module.default as Configuration

if (previous === undefined) delete process.env.OPENCODE_CHANNEL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: the env restore runs after await import(...) without try/finally, so if the import throws, the mutated OPENCODE_CHANNEL leaks into subsequent tests. Only matters when the config module is already broken, but a finally would keep those failures isolated. Applies to both tests in this file.

@Hona Hona enabled auto-merge (squash) June 10, 2026 15:42
@Hona Hona merged commit 2e0f88d into anomalyco:dev Jun 10, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux desktop app icon missing after Electron packaging update

2 participants