Summary
There is no way to take a session you already have open in a tab and move it into its own window. Ctrl+Shift+N (File > New Window) gives you an empty window on Home, and you then have to find that same session again and re-open it. The tab context menu offers only "Rename" and "Close tab".
Right-click a tab → Open in new window would do it in one action, and the tab menu is already being extended (see #56114), so this is an addition to an established surface rather than a new one.
Search first, so this is not a duplicate
The following return zero results in this repo: "detach tab", "tear off". No issue title or body asks to move a session tab into a separate window. The related items below are cited because they establish the existing machinery this feature would use, not because they are the same request.
- New Window shortcut (Ctrl+Shift+N) does nothing on Windows desktop #41592 — proves File → New Window works from the menu today (only the Windows accelerator was unwired). This issue is not asking for multi-window support; it asks to route an existing tab into one.
- [Bug]: Desktop auto-update discards window tab layout (new window ID, old window state orphaned) #46938 — documents that tab layout is persisted per window UUID (
opencode.window.<uuid>.dat, holding tabs, tabs.recent, tabs.info, tabs.closed, keyed from windowIds in settings). Detaching a tab is moving one entry between two of those records, which is the state model this feature has to respect.
- [Bug][Desktop v2] Middle-clicking a subagent opens a separate Not Found window #38949 — an "open this session as a separate window" path is already reachable from session context and lands on
Not Found for child sessions. This is evidence the path exists and is incomplete, rather than absent.
- desktop: per-window permission handler on a shared Electron session gets overwritten #51748 — open; per-window state on the shared Electron session is not isolated. Any detach feature inherits this, so treat it as a dependency rather than something this issue introduces.
- feat(desktop): restore new-session deep link and add open-session #57246 (PR, open) and [FEATURE]:
opencode://new-session in OpenCode 2's desktop app, as in OpenCode 1 #55106 — the open-session deep link. This is the transport the detach action should reuse instead of inventing a new IPC route.
- fix(desktop): stop Ctrl+W from closing the window on Windows/Linux #54557 (PR, open) and desktop: Ctrl+W closes the whole window instead of the current tab #52683 — active work on tab-vs-window command close semantics in the same dispatch layer. Worth coordinating to avoid a collision.
- [FEATURE]: Add Delete and Export options to the tab menu #56114 — open request to add Delete and Export to the same tab context menu; confirms this menu is the accepted home for tab actions.
Proposed behaviour
Add one item to the tab context menu, between "Rename" and "Close tab":
- Label:
Open in new window
- i18n key:
common.openInNewWindow
- Action: create a new window and open that tab's session in it.
When the detached tab is the only tab in its window, keep the source window alive and open the session in the new window. That is predictable and non-destructive. Whether the source tab should then close is a product decision better handled as a follow-up; it is also the point where this feature could become surprising, so it should be explicit.
Implementation sketch (not prescriptive)
Written against dev, where the shell differs from the packaged 1.19.4 bundle: the menu action enum is an Effect RPC schema (packages/desktop/src/shared/ipc-rpc/menu.ts), the dispatch is runDesktopMenuAction in packages/desktop/src/main/native/menu-actions.ts, and the window factory is makeMainWindows().create(id?, early?) in packages/desktop/src/main/windows/index.ts.
- Menu item —
packages/app/src/shell/titlebar/tab-nav.tsx: a third Menu.Item inside Menu.Context.Content beside common.rename / common.closeTab, with a new onOpenInNewWindow prop.
- Action enum — add the member to
DesktopMenuAction in packages/desktop/src/shared/ipc-rpc/menu.ts (runtime gate) and to the mirroring @opencode/app/desktop-menu type. This dual declaration is the most likely compile break, so both must change together.
- Dispatch —
packages/desktop/src/main/native/menu-actions.ts: a new case plus a handler slot alongside createWindow / installCli / relaunch; wire it in packages/desktop/src/main/ipc-handlers/menu.ts.
- Window creation with a target — thread an optional session id through
makeMainWindows().create(...) and windowArguments(id) in packages/desktop/src/main/windows/bootstrap.ts. packages/desktop/src/shared/window-bootstrap.ts already carries WindowBootstrap { id, firstLaunchPending?, packaged? } through additionalArguments, which is the natural carrier; extend it rather than adding a parallel channel.
- Renderer consumption — the new window reads that payload at boot and opens the session instead of Home. If feat(desktop): restore new-session deep link and add open-session #57246 lands first, reuse its
open-session deep link as the transport and keep the bootstrap payload to just the action.
A matching command-palette entry could reuse the same handler, but is optional.
Why not just use New Window
Ctrl+Shift+N creates an empty window on Home. The user must then relocate a session they already had open, losing scroll position and any in-flight state in the original window, and then close the old tab by hand. The menu item is nearly the same amount of code but one action instead of three, and it is the only version that can target a specific session programmatically.
Environment
- OpenCode desktop 1.19.4 (packaged), and
dev at time of filing for the source paths above.
- Windows.
- Bundle-level evidence gathered from
resources/app.asar of the installed app: menu definitions, out/main/index.js, IPC handler names, and a string search of the renderer bundle.