Skip to content

feat(floating): open the floating terminal in a separate window - #44303

Closed
tomarai85 wants to merge 2 commits into
stablyai:mainfrom
tomarai85:feat/floating-workspace-separate-window
Closed

tomarai85 wants to merge 2 commits into
stablyai:mainfrom
tomarai85:feat/floating-workspace-separate-window

Conversation

@tomarai85

@tomarai85 tomarai85 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The floating workspace lives inside the main Orca window, so anything that fills the main window, such as a Markdown preview, covers the agent. This adds a button that opens the floating workspace's active terminal in its own window. It is the same terminal session, not a copy.

What Changed

Before: the floating terminal can only be shown inside the main window.

After: the floating panel's controls have an "Open in separate window" button. It shows when the active floating tab is a terminal with a running PTY, and not in the paired web client. Clicking it opens that PTY in a native window and hides the panel. Clicking it again for the same PTY focuses the window that is already open. Closing the window leaves the session running, and reopening the floating workspace shows it as before.

Mechanism:

  • The first commit moves the dashboard pop-out's window setup (sandboxed preload, isolated partition, deny-all permissions, navigation policy, zoom and paste handling) into a shared createPopoutWindow in src/main/window/popout-window.ts. The dashboard pop-out keeps its own bounds handling and behaves as before.
  • The terminal window is built on that factory. It loads popout.html?surface=terminal&ptyId=…, which renders the existing AgentTerminalPreview over the existing terminalPreview IPC. There is no new terminal renderer and no new PTY data channel.
  • terminalPreview connect, input, ack, fit and unsubscribe accept a terminal pop-out only for the PTY it was opened for. The clipboard text check and the native selection action admit terminal pop-outs as they admit the dashboard pop-out. terminalPopout:open is accepted only from the trusted UI renderer.

Why

#22167 asks for this. Building on the dashboard pop-out's window and terminal preview keeps the change small. I sent this earlier as #39722 (2,347 lines, with a hide and dock lifecycle and an experimental setting) and #39992 on top of it. This PR is the core of #39722, cut down to one button.

Alternatives considered: moving the in-window xterm into another window (a renderer cannot hand its xterm to another one, so the PTY would have to re-attach anyway), and a full workspace window with tabs (the size of #39722).

Linked Issue

Fixes #22167

The issue also mentions drag-to-detach. That is not in this PR.

Visual Proof

Before: the floating panel has Maximize and Minimize only. The terminal cannot leave the main window.

After:

Floating panel with the Open in separate window button The separate window after a command was typed into it

Both images come from the background e2e run, so the OS window frame is not in them.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

I did not test it by hand. It is checked by the tests below, on macOS only.

  • Unit, src/main/ipc/terminal-views/terminal-preview-popout-trust.test.ts: a terminal pop-out can type into its own PTY and not into another, and an unknown sender is refused. It fails when the PTY scoping is removed.
  • E2E, tests/e2e/layout/window-tabs/floating-terminal-separate-window.spec.ts (background launch): clicking the button opens a window for that PTY and hides the panel, the terminal has focus, a typed command runs, and the in-window pane shows its output after the floating workspace is reopened. It passed 2 of 2 with --repeat-each=2.
  • pnpm check:changed: 39 of 41 checks pass. main-sync-fs-ratchet and main-blocking-helper-ratchet fail the same way on a clean origin/main (they report profile-cloud-session-store.ts), so they do not come from this branch.
  • Not tested on Linux, Windows, SSH or a paired remote runtime.

Risk

Level: Low

The riskiest part is that the dashboard pop-out now goes through the shared factory. Its window options, partition, title, permission handlers, zoom and paste handling moved unchanged, and its bounds save and restore stay in its own module. If this regressed, the dashboard pop-out would open with the wrong zoom or lose paste.

A terminal pop-out renderer can read and write only its own PTY. No saved data or settings change. A plain revert backs it out.

AI Disclosure

Written with Claude Code (Claude Opus 5.5).

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Size: 21 files, +523 / −196. About 170 of the added lines are moved from dashboard-popout-window.ts, and 111 are tests.

Known limits:

  • One window per PTY, fixed when it opens. It does not follow the floating workspace's active tab and has no tabs.
  • Window size and position are not remembered. The title is "Orca Terminal".
  • As in the dashboard's terminal preview: shorter scrollback, no search, text-only paste, and links do not open from it.

If you would rather ship it behind an experimental setting first, I can add one.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out

Move the companion-window setup (sandboxed preload, isolated session,
deny-all permissions, zoom follow, paste and zoom chords, localized
title) into popout-window.ts so a second pop-out kind can reuse it.
The dashboard keeps its single window, saved bounds and open/close
broadcast. The View menu zooms whichever pop-out is focused.
Add an "Open in separate window" button to the Floating Workspace.
It opens the active terminal pane in its own native window, built on
the shared pop-out setup and the dashboard's terminal preview, and
hides the in-app panel. Opening the same terminal again focuses its
window. The window may preview, type into and copy from only the PTY
it was opened for, and it closes with the main window.

Refs stablyai#22167
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change adds a shared native pop-out window implementation and uses it for terminal pop-outs keyed by PTY ID. The renderer can open the active floating-terminal tab in a separate window. Terminal preview IPC checks that a terminal pop-out sender is associated with the requested PTY. The change also updates pop-out renderer selection, clipboard text sender authorization, zoom handling, and main-window cleanup. Tests cover PTY-scoped preview authorization and the separate-window workflow.

Merge Risk: Low · up to 15591

The separate-window terminal feature looks sound and keeps PTY access scoped to each window. One minor behavior issue is shared zoom across multiple terminal pop-outs, mainly in development builds. The e2e assertion for the reopened terminal should also move to the DOM. Neither should block merge, but both are worth fixing.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(floating): open the floating terminal in a separate window" matches the main change. The PR adds an "Open in separate window" button that moves the floating workspace's active terminal…
Linked Issues check Passed [#22167] The core request is a separate native window for floating terminal content, with the same session kept functional. The PR adds an "Open in separate window" control in FloatingTerminalWindowCo…
Out of Scope Changes check Passed All changed areas connect to the terminal pop-out objective. Changes in register-core-handlers.ts, terminal-popout.ts, terminal-preview.ts, ui.ts, clipboard-ipc-sender-trust.ts, createMainWindow.ts, p…
Description check Passed The description follows the repository template closely. It has the ELI5, What Changed, Why, Linked Issue (Fixes #22167), Visual Proof, Testing, Risk level, AI Disclosure, the upstream boundary checkb…
Full details: Title check

Explanation

The title "feat(floating): open the floating terminal in a separate window" matches the main change. The PR adds an "Open in separate window" button that moves the floating workspace's active terminal PTY into a native window. The title is short, specific, and follows a conventional commit style.

Full details: Linked Issues check

Explanation

[#22167] The core request is a separate native window for floating terminal content, with the same session kept functional. The PR adds an "Open in separate window" control in FloatingTerminalWindowControls.tsx. It shows when the active floating tab has a PTY and is not in a paired web client. Selecting it calls terminalPopout:open, which calls openTerminalPopout in terminal-popout-window.ts. That function creates a window via the shared createPopoutWindow factory (popout-window.ts). The window loads popout.html?surface=terminal&ptyId=… and renders AgentTerminalPreview over the existing terminalPreview IPC, so the existing PTY session is reused. Closing the window leaves the PTY running, and reopening the floating workspace shows the pane again. Repeated opens for the same PTY reveal the existing window. The issue's proposed solution also lists drag-to-detach "if feasible" and docking back into the main window. The PR does not implement drag-to-detach, as the PR description states. It does not add a dock-back action. The reopen path after closing the window partly covers the return case. These two items are secondary to the core request and are not treated as blocking. The PR also has no manual test. Its unit test and e2e test cover the PTY scoping and the open flow on macOS only, per the PR description. Those automated tests were not re-run in this assessment.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to the terminal pop-out objective. Changes in register-core-handlers.ts, terminal-popout.ts, terminal-preview.ts, ui.ts, clipboard-ipc-sender-trust.ts, createMainWindow.ts, popout.tsx, preload API files, and the terminal-popout renderer add the new window and its scoped IPC. The dashboard-popout-window.ts reduction (+14/-170) moves window setup into the shared popout-window.ts factory. The PR states this is needed so the terminal window reuses the same setup. The dashboard pop-out keeps its bounds handling. The zoom change in main-process-i18n-menu.ts (zoomPopoutIfFocused) and the clipboard and selection trust changes apply to both pop-out kinds. That is a direct consequence of the shared factory. The i18n strings, the unit test, and the e2e test support the new feature. No unrelated change was found in the summary. The refactor of the dashboard pop-out is a supporting change, and its behavior claims are not verified by this assessment beyond the PR description and summary.

Full details: Description check

Explanation

The description follows the repository template closely. It has the ELI5, What Changed, Why, Linked Issue (Fixes #22167), Visual Proof, Testing, Risk level, AI Disclosure, the upstream boundary checkbox, and the checklist. It explains the mechanism, the alternatives considered, the known limits, and how to back out the change. Visual proof is included as images, and the testing section names the unit and e2e tests with their results. Minor gaps: the manual-test checkbox is unchecked and the author states manual testing was not done, the Notes section from the template is replaced by a size note, and the Linked Issue section does not say the template's Notes checks (security, cross-platform, SSH, mobile) were reviewed. These gaps are not critical.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b48f721d-2f9d-4c4a-ba3c-4df59b2ac56e
Commits

Reviewing files that changed from the base of the PR and between 92b842c and 155912e.

Files selected for processing: 21

  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/main/ipc/terminal-views/terminal-popout.ts
  • src/main/ipc/terminal-views/terminal-preview-popout-trust.test.ts
  • src/main/ipc/terminal-views/terminal-preview.ts
  • src/main/ipc/ui.ts
  • src/main/startup/main-window/main-process-i18n-menu.ts
  • src/main/window/clipboard/clipboard-ipc-sender-trust.ts
  • src/main/window/createMainWindow.ts
  • src/main/window/dashboard-popout-window.ts
  • src/main/window/popout-window.ts
  • src/main/window/terminal-popout-window.ts
  • src/preload/api-types.ts
  • src/preload/api/terminal/terminal-preview-bridge.ts
  • src/preload/api/window-ui/dashboard-api.ts
  • src/preload/index.ts
  • src/renderer/src/components/floating-terminal/FloatingTerminalPanelSurface.tsx
  • src/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx
  • src/renderer/src/components/terminal-popout/TerminalPopoutRoot.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/popout.tsx
  • tests/e2e/layout/window-tabs/floating-terminal-separate-window.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

}
const window = createPopoutWindow(store, {
getTitle: () => translateMain('native.dialog.terminalPopoutTitle', 'Orca Terminal'),
partition: 'orca-terminal-popout',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Give each terminal pop-out a separate zoom partition.

In development, open pop-outs for PTYs A and B, then zoom A. Both windows use this partition and the same ELECTRON_RENDERER_URL hostname. Electron 43.8.10 stores default zoom by hostname, so B changes too. Opening B can also reset A to the persisted app zoom. Different ptyId query values do not isolate this hostname-based zoom state. (raw.githubusercontent.com)

Use a distinct partition per PTY window. Keep the existing store subscription so explicit app-wide zoom changes still reach every pop-out.

Comment on lines +56 to +57
?.serializeAddon?.serialize()
.includes(text) ?? false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Assert the reopened terminal output through the DOM.

serializeAddon.serialize() can contain the marker even when the reopened terminal does not render it. Panel visibility alone does not catch that failure.

Replace this model assertion with a DOM assertion for ok-${marker} inside the reopened terminal pane.

As per coding guidelines, “assert user-visible behavior through the DOM”.

Source: Coding guidelines

@tomarai85 tomarai85 closed this Nov 23, 2026
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.

[Feature]: Allow opening floating terminal / floating workspace in a separate window outside the main app window

1 participant