Native Preferences showed "The CodeNomad window that opened Preferences is no longer available" with disabled startup controls whenever its opener was unknown (Preferences restored at launch) or closed, even with CodeNomad windows open. Startup state (restore previous state, saved snapshot, Clear) is each window's own, so the host now adopts the most recently used local window as the opener in that case: Electron through PreferencesWindowRegistry.adoptOpener (startupStateTargetId), Tauri through set_opener (startup_state_target). The epoch rotates on adoption, so a change prepared for another window degrades to a read of the adopted one before any write. The warning and its string in all ten locales are removed; the card re-reads up to three times while the adopted window starts and stays disabled only when no local window can answer. Code contracts, AGENTS.md and the public help in all ten locales describe the opener, otherwise the most recently used window. Stats' text Refresh button becomes the shared icon button sized like the period select, keeping its localized accessible name and tooltip; the icon spins while a read runs. Validation: Electron unit tests for live/closed/unknown openers, adoption, epoch rotation and fenced changes; Tauri unit test for adoption and fencing; preferences-startup-state (Electron and Tauri hosts), other-profiles and service-usage browser tests; UI and Electron typechecks; help test; rustfmt check. Independent review: the first pass found that startup state is per window and that the fence no longer followed the target; the adoption fix was re-reviewed and approved, with two trivial notes applied. |
||
|---|---|---|
| .. | ||
| electron | ||
| scripts | ||
| .gitignore | ||
| electron.vite.config.ts | ||
| NOTIFICATION_BADGES.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
CodeNomad App
This package contains the native desktop application shell for CodeNomad, built with Electron.
Overview
The Electron app wraps the CodeNomad UI and Server into a standalone executable. It provides deeper system integration, such as:
- Native window management
- Global keyboard shortcuts
- Application menu integration
Each channel/config profile runs one native singleton process and one backend. A second launch opens another UUID-backed window by default; Advanced settings can restore most-recent-window focus, while --new-window always requests another window. Stable, dev, and non-default config profiles keep native/browser/client state isolated. OpenCode sessions/messages remain shared, while tabs, drafts, and views belong to each window.
Restore state uses a V3 per-window envelope over the V2 content-addressed partition graph, with atomic publication/migration, ownership-fenced writes, and post-commit conservative garbage collection.
Development
To run the Electron app in development mode:
npm run dev
This will start the renderer (UI) and the main process with hot reloading.
Building
To build the application for your current platform:
npm run build
To build for specific platforms (requires appropriate build tools):
- macOS:
npm run build:mac - Windows:
npm run build:win - Linux:
npm run build:linux
Structure
electron/main: Main process code (window creation, IPC).electron/preload: Preload scripts for secure bridge between main and renderer.electron/resources: Static assets like icons.