feat(desktop): multi-window support with per-window panel selection
What
You can now open the same workspace in several windows and keep a different tab focused in each one. Tab structure (create, close, rename, layout) stays in sync between windows; which tab you're looking at does not.
Two new entry points: right-click a workspace in the sidebar for "Open in New Window", or right-click a tab for "Open Tab in New Window", which opens the new window already focused on that tab. Cmd+Shift+N still works as before. Each window can also sit on a different workspace entirely, and sidebar/panel visibility is per-window.
Why
The tabs store keys selection by workspace (activeTabIds[workspaceId]), and the whole state persists as a single blob with no change notifications between windows. Open the same workspace twice and both windows boot with identical state, then silently overwrite each other's writes. In practice a second window was useless: same panel everywhere, and closing a tab in one window could resurrect it from the other window's stale write.
How
- Selection stays in each window's own renderer and never syncs. The persisted values only seed the first paint.
uiState.tabs.setnow broadcasts each write through a newuiState.tabs.onChangesubscription (observable, per the trpc-electron constraint), tagged with the source webContents id. Windows merge remote structure and keep local selection. If a remote close orphans the focused tab, the existing MRU resolver picks the replacement.- The storage adapter drops echo writes during a remote merge, including a pre-merge local write still waiting in the debounce window. That stale-flush case is what used to resurrect closed tabs, and it now has unit tests (
trpc-storage-adapter.test.ts). The adapter moved to its own file so those tests don't pull in the electron client. window.selfandwindow.openWorkspaceWindoware new tRPC procedures;focusTabIdrides the window query string next toworkspaceId.
There's also a small fix in windows/manager.ts: the closed handler read window.webContents after destruction, which throws in real Electron. The id is now captured at registration.
Known limitation
Persistence is still an unversioned full snapshot, so two structural edits from different windows inside the same 300ms debounce can lose one write. Structural edits are human-paced so I've accepted this for now; the plan doc (apps/desktop/plans/20260607-per-window-panel-selection-and-sync.md) describes a basedOnVersion scheme if it ever becomes a problem.
Testing
bun testfor the desktop app: 454 pass under the touched trees (merge logic, adapter suppression, window manager), 0 fail. Three pre-existingshell-wrappersfailures reproduce on a clean checkout and are unrelated.tsc --noEmitand Biome clean.- Verified live with two windows on one workspace over CDP: independent active tabs, tab create/close propagating both ways with selection preserved, and per-window workspace routing.
Summary by cubic
Enables true multi-window use in the desktop app. Open the same workspace in several windows with independent tab focus; tab/pane structure stays in sync across windows. Recent changes harden persistence and IPC for reliability.
-
New Features
- Open multiple windows for the same or different workspaces; each window keeps its own active tab, pane focus, and sidebar/panel visibility.
- Live cross-window sync of tab/pane structure; selection stays local per window. Echoes are filtered by window identity via
window.self. - New entry points: “Open in New Window” on a workspace, “Open Tab in New Window” on a tab, and Cmd/Ctrl+Shift+N. New windows can target a specific tab.
-
Bug Fixes
- Prevents closed tabs from “resurrecting” by suppressing stale/echoed writes during remote merges.
trpc-storage-adapternow writes via tRPC before bumping the local snapshot version to avoid masking failed writes. - Avoids “Object has been destroyed” errors by capturing the caller
webContentsIdonce and using it inwindow.selfanduiState.tabs.set, and by capturing ids before window cleanup.
- Prevents closed tabs from “resurrecting” by suppressing stale/echoed writes during remote merges.
Summary by CodeRabbit
Release Notes
- New Features
- Added multi-window support—open workspaces in separate Electron windows via the Window menu's "New Window" option (⌘⇧N) or context menu actions for workspaces and tabs
- Cross-window tab synchronization—pane structure syncs seamlessly across all open workspace windows while preserving independent tab selection per window