fix(desktop): make New Window reachable without the native menu bar
What & why
New Window is now reachable on Linux and Windows, where multi-window (#5337) previously had no working trigger. Three entry points:
- a New window item in the organization dropdown and a New window command in the command palette — both call the existing
window.openNewtRPC mutation, so every trigger funnels through the same main-process path as the native menu item, and the new window inherits the calling window's organization; - the OS shell's own "New Window" (GNOME top-bar/dock app menus): the packaged desktop action relaunches the executable with
--new-window, and the single-instance handler opens a window when it sees that flag. A plain relaunch keeps the Electron-standard focus-the-running-app behavior, so a Start-menu or launcher re-click never stacks extra windows; deep-link relaunches are unchanged (focus + process the link), and the handler bails during quit so auto-update restarts can't spawn a phantom window. The AppImage's desktop file declares that action explicitly (Actions=new-window;plus the action group — electron-builder emits the group but omits the exposingActions=key, so it is set viadesktop.entry), since GNOME only shows its own heuristic "New Window" item intermittently for running apps — a declared action is always shown.
Previously the native File → New Window menu was the feature's only trigger. On macOS that menu lives in the system menu bar, but Linux and Windows run a frameless window (frame: false), and Electron never renders a menu bar for frameless windows — Alt does nothing and even setMenuBarVisibility(true) is a no-op (verified on Electron 41.10.3 with the app's exact window flags). The Ctrl+Alt+N accelerator still fires, but there was nothing to click — and GNOME's shell-level "New Window" silently did nothing because the second instance only focused the first window.
macOS impact: the native menu path is untouched (menu.ts and the window-creation code are unchanged), the two renderer surfaces are additive, and the one main-process change is an additive branch in the second-instance handler — on macOS a second instance only spawns on an explicit open -n/CLI relaunch, where opening a window matches what was asked for. One scope note: the error toast covers a failed renderer-to-main call; a failure inside main-process window creation stays console-logged as before (surfacing it would need wider main-process changes — left as follow-up).
Related: #5337
How I tested it
Drove the running Linux dev app over CDP per CONTRIBUTING's flow, with real clicks:
- Organization dropdown → New window: a second app window opened, showing the same organization as the caller. Verified from the first window, from a newly-opened window, and from the collapsed-sidebar avatar variant.
- Command palette → search "new window" → run: another window opened.
- OS shell path: relaunched the running app with
--new-window(what the packaged desktop action does) — the primary logged the request and opened a new window (count 1 → 2); a plain relaunch left the count unchanged and focused the running app. - No console errors; window restore-on-relaunch still works (all open windows came back after the dev main-process restart).
Before/after screenshots were captured from the CDP session (menu open showing the new item; the second window). I can attach them on request — the capturing agent could not upload images from its environment.
Checks: bun run lint and bun run typecheck pass; the desktop bun test suite is green apart from one failure that exists on the base branch and is unrelated to this change (terminal-ws-transport sleep/wake test; jest.advanceTimersByTime unsupported under bun test).
Platform coverage, stated honestly: verified end-to-end on Linux (GNOME/Wayland). Windows shares the identical frameless setup and code paths but was not exercised on a Windows machine. On macOS the changed second-instance branch is reachable only via explicit second-launch, and the menu/window-creation code is untouched.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
Summary by CodeRabbit
- New Features
- Added a “New window” action to the command palette.
- Added a “New window” option to the organization dropdown menu.
- Added a “New Window” desktop shortcut on Linux.
- Relaunching with the “New Window” shortcut opens a separate window.
- Displays an error notification if a new window cannot be opened.
- Bug Fixes
- Relaunching normally now focuses the existing app window instead of opening an unintended duplicate.