opencode/packages/desktop
James Long cec405d4bc fix(desktop): tighten pill ownership and Linux lock fallback
Keep one visible-session owner for the window pill, hide it under frozen overlays, and dispose its embed and WebContents with the window. Simplify Linux lock detection to login1 plus the existing idle fallback, add the same-user User.Display lookup when PID lookup fails, and stop retrying when gdbus is absent.

Update the unit and component fixtures for the current pane client and pill lifecycle.

User decisions:
- Keep the top-center pill and preserved browser state
- Use one visible pane as the pill owner; no extra windows
- Remove the redundant xscreensaver watcher and second source combiner
- Fall back to login1 User.Display only when PID session lookup fails
2026-11-10 00:59:09 +00:00
..
icons fix(desktop): ship the Icon Composer app icon on macOS (#60020) 2026-10-30 14:40:47 +10:00
perf chore: bench with strobe 0.6.0; the desktop's first launch starts without GPU shader caches (#61683) 2026-11-04 09:53:28 -06:00
resources ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
script refactor: run every benchmark with strobe (#60880) 2026-11-03 20:05:16 -06:00
src fix(desktop): tighten pill ownership and Linux lock fallback 2026-11-10 00:59:09 +00:00
.gitignore feat(desktop): reintroduce AppStream MetaInfo for Linux desktop builds (#27253) 2026-05-13 13:14:39 +08:00
AGENTS.md docs(app): require explicit state machines for lifecycle state (#61718) 2026-11-04 11:35:16 -06:00
drizzle.config.ts fix(desktop): persist renderer state in SQLite instead of electron-store (#47695) 2026-09-07 10:51:46 +10:00
electron-builder.config.test.ts fix(desktop): describe macOS folder access in the app bundle (#60503) 2026-10-30 16:28:59 +10:00
electron-builder.config.ts fix(desktop): describe macOS folder access in the app bundle (#60503) 2026-10-30 16:28:59 +10:00
electron.vite.config.test.ts ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
electron.vite.config.ts fix(desktop): prevent main bundle require collision (#60430) 2026-10-30 13:07:47 +10:00
package.json refactor: run every benchmark with strobe (#60880) 2026-11-03 20:05:16 -06:00
README.md docs: strobe moved to github.com/anomalyco/strobe (#62706) 2026-11-08 18:33:20 -06:00
sst-env.d.ts zen: update sst version 2026-02-18 13:54:23 -05:00
tsconfig.json refactor: run every benchmark with strobe (#60880) 2026-11-03 20:05:16 -06:00

OpenCode Desktop

The OpenCode Desktop app, built with Electron.

Development

bun install
bun dev

Build

bun run build prepares resources/ (icons, metainfo and the bundled CLI) and builds the app into out/. bun run pack then packages it, unsigned, into dist/desktop/ at the repository root: a .app tarball on macOS, the unpacked app on Windows, and AppImage/deb/rpm on Linux. The release workflow signs and notarizes afterwards.

bun run build && bun run pack

Both read the same environment as every other release package:

Variable Meaning
OPENCODE_CHANNEL dev (default), beta, or latest/prod. Picks the app identity, icons and bundled CLI.
OPENCODE_VERSION Version stamped into the app and its packages.
OPENCODE_TARGET darwin-arm64, darwin-x64, windows-arm64, windows-x64, linux-x64, linux-arm64. Defaults to the host.

The CLI is placed outside app.asar in the application's resources directory, and packaging fails if it is missing. bun run build uses packages/cli/dist when that holds the target's CLI. Otherwise dev (and local, unset or unrecognized) downloads the published dev CLI, beta downloads the beta CLI, and prod/latest fail.

bun dev is separate from packaging: it uses local renderer/server mode, the dev app identity, and the CLI source by default. bun dev --download-server <version> instead downloads that CLI version for local development.

Beta channel

Every push to the beta branch publishes OpenCode Beta (ai.opencode.desktop.beta) as version 0.0.0-beta-<run> to the beta update channel. Beta publishes only the desktop app and beta.opencode.ai; the CLI and SDK packages ship from dev. Install it from https://opencode.ai/update/api/beta/desktop/opencode/<asset>, for example opencode-desktop-mac-arm64.dmg or opencode-desktop-win-x64.exe. Installed builds update in place on every platform.

Each beta build compiles in its commit and the feat, fix and perf commits among its newest 200 (script/beta-notes.ts, embedded by electron.vite.config.ts; run bun script/beta-notes.ts to preview them). After an update, the beta app lists the ones after the commit of the build the user saw last in a "What's new in beta" dialog, unless release notes are turned off in Settings.

Startup benchmark

perf/startup.bench.ts times a launch with strobe, from process spawn to what a person waits for, in pairs of launches of two builds with an interval per case. Every launch runs in a private home (its own %APPDATA%, XDG folders, database, config and service registration, the developer's OPENCODE_*, OTEL_* and SENTRY_* environment removed), so it never touches the developer's app, profile or live service.

Case Launch Ends on
launch to Home Profile kept from earlier launches; the service already runs, from the bundled CLI. Home
launch to a restored tab Profile kept; the first launch's onboarding draft is restored. The composer
launch to Home, service stopped Profile kept; the desktop spawns its service. Home
first launch No profile or GPU shader caches: right after an install, onboarding opens a draft. The composer
dev start to Home bun dev:desktop with Vite's caches and out deleted. Home
# A returning user's launches of two packaged builds (pack each with OPENCODE_CHANNEL=beta or prod), or two installed
# channels.
strobe bench perf/startup.bench.ts --target desktop --base exe:<old>/OpenCode.exe --head exe:<new>/OpenCode.exe
strobe bench perf/startup.bench.ts --target desktop --base app:opencode --head app:opencode-beta

# The first launch after an install.
strobe bench perf/startup.bench.ts --target install --base app:opencode --head app:opencode-beta

# The dev loop's cold start, dev against this checkout.
strobe bench perf/startup.bench.ts --target dev --base origin/dev --head .

strobe runs on Windows, macOS and Linux. Windows measures the most; on macOS a packaged launch needs a build whose bundle id this account has never run (packages/app/perf/README.md lists what each OS gives).

Besides launch.ready, each launch reports its milestones as launch.<name> in ms since spawn: the main process's own marks from its log (entry, electron, window, served, bundle, logging, storage, init, layers, visible, service.starting, service.ready; src/main/lifecycle/marks.ts), or each step of the dev command's output. launch.painted and launch.settled are when the window's pixels first and last changed, cpu.work is the CPU every process used until ready, and launch.node.* is Node's bootstrap timing in builds that accept --inspect. The first launch of each build is discarded, because a new binary pays the antivirus scan. The packaged returning-user cases keep the GPU shader caches their build compiled in earlier launches, as a person's machine has them; first launch starts each launch without them. --why always adds a profiled launch per build: the main process and the renderer, both from their first statement.

A packaged beta or prod build registers itself as the opencode:// handler when it starts, even from the bench; the installed app takes the registration back on its next launch. Those channels run with HTTPS_PROXY pointed at a closed port (--offline forces it for dev) so the updater's first check fails fast instead of reaching GitHub.