Skip to content

feat(desktop): open more windows that share the main window's connection - #4

Open
na0s-fleet-agents[bot] wants to merge 7 commits into
mainfrom
feat/desktop-multi-window-hub
Open

na0s-fleet-agents[bot] wants to merge 7 commits into
mainfrom
feat/desktop-multi-window-hub

Conversation

@na0s-fleet-agents

@na0s-fleet-agents na0s-fleet-agents Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Use case

From the multi-window use case behind this stack (#2):

I find myself bouncing between vastly different projects when I clock out of paid work and into hobby work. Thread filtering is fine, but it has no quick switching and can't tap into the spatial mapping you get with multiple desktops or macOS Spaces. So here is Multi-Window. To keep things cheap and as consistent as possible, the primary window owns the connections and shared state, and secondary windows only host UI.

Problem

The desktop app has one window, so you can't put one set of projects on one desktop or Space and another set on the next. A second window that worked like the first would open its own connection to every environment, sign in again, and hold its own server subscriptions, doubling the work for each thread it shows. It would also write the same stored UI state and composer drafts as the first window, so one window's save would overwrite the other's.

Change

  • Adds New Window to the desktop app: in the command palette, in the Window menu, and on Cmd/Ctrl+Alt+Shift+N (rebindable as window.new).
  • A new window has no sockets of its own. The main window's renderer acts as a hub: it passes each environment's RPC traffic through a MessagePort and shares its subscriptions. A new window does not reconnect or sign in again, and every window receives a thread's updates from the same stream.
  • Closing the main window while other windows are open hides it, because they connect through it. On Windows and Linux it closes when the last other window closes.
  • The desktop shell accepts IPC from every app window. Dialogs, context menus, zoom, reload, screenshots and preview tabs go to the window that asked for them, and each window gets its own preview tabs.
  • Windows merge shared UI state and composer drafts. A save in one window no longer overwrites changes made in another.

User docs: docs/user/multiple-windows.md.

Scope and approval

This is a feature with no maintainer approval yet. It is filed on my fork and proposed upstream in an Ideas discussion: link added after posting.

Verification

  • vp fmt, vp lint, the web and desktop typechecks, and vp run check:changed against fork main all pass. The affected tests also pass: client-runtime hub, relay and session; desktop window, menu, IPC and preview; web stores and keybindings; and the CommandPalette and ElectronBrowserHost browser tests.
  • Ran the real Electron app under Xvfb with an isolated home and the dev replay provider. Steps:
    1. Pressed Ctrl+Alt+Shift+N to open a second window.
    2. In that window, opened an existing thread and sent a message. The turn streamed in and completed, and the main window showed the same turn.
    3. On reload, the second window opened no server WebSocket; only the main window did.
    4. Reloaded the main window, then sent another turn from the second window. It completed.

Evidence

Electron desktop dev build (vp run dev:desktop) on Xvfb, light theme, isolated --home-dir and Electron profile, one synthetic northwind project with a replayed thread, driven over CDP. Captured at 5a5dc93dd4; the commits after it on this branch are refactors, a test change and a docs change. All captures are after only: main has no second window to compare with.

Step After — 5a5dc93
Second window opens an existing thread The second window shows the Hub check thread and its earlier replayed turn, loaded through the main window
A turn sent from the second window streams The second window shows the message Again from the second window, the turn Working, and the thread under Working in the sidebar
The turn completes in the second window The second window shows the finished turn, Worked for 5.2s
The main window has the same turn The main window shows the same thread; its last turn reads Worked for 5.2s, as in the second window
The second window after the main window reloads The second window still shows the thread after the hub reloaded

Step 3 (no server WebSocket from the second window) has no screenshot.

Known limitations

Seen on the earlier combined branch (636249f) and not rechecked on this head:

  • One thread in two windows. The preview belongs to one window. The other shows a placeholder.
  • Background agent previews are hosted only in the main window or the window showing that thread.
  • DPoP renewal isn't relayed. A secondary window keeps its lease token until it reconnects.
  • Not verified: per-window memory, macOS and Windows. All testing was on Linux under Xvfb.

Stacked PR

This is the base of a stack. feat/desktop-multi-window (#2) builds on it with saved windows, per-window project filters and themes, the project-colour tint, the Windows settings section and Mini Mode.

🤖 Generated with Claude Code

Na0s and others added 7 commits November 23, 2026 10:06
Secondary windows are thin clients: the main window's renderer is a hub that
relays each environment's RPC over a MessagePort and shares its subscription
streams, so a new window opens without its own sockets or auth. The desktop
shell opens them from New Window (command palette, Window menu, and
mod+alt+shift+n), trusts IPC from every app window, scopes preview tabs to
the window that shows them, and keeps the main window hidden rather than
closed while it serves other windows. Windows merge their shared UI state and
composer drafts instead of overwriting each other's saves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reuses its supervisor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ir window

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mponent state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@na0s-fleet-agents
na0s-fleet-agents Bot force-pushed the feat/desktop-multi-window-hub branch from b4b4943 to bfcf1b2 Compare November 23, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant