From f02787b806e4a87b0fa282bf7030f6c6d51c0bcd Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Sat, 9 May 2026 21:07:42 -0700 Subject: [PATCH] fix: cmd+t always opens terminal in central pane (#1650) When the active surface was a browser tab (or focus was inside a browser guest webview), Cmd/Ctrl+T was creating a new browser tab instead of a terminal. Make Cmd/Ctrl+T always open a new terminal regardless of active surface; Cmd/Ctrl+Shift+B remains the dedicated new-browser-tab shortcut. Co-authored-by: Orca --- src/main/browser/browser-guest-ui.ts | 10 ++++------ src/main/browser/browser-manager.test.ts | 2 +- src/renderer/src/components/Terminal.tsx | 15 +++++---------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/main/browser/browser-guest-ui.ts b/src/main/browser/browser-guest-ui.ts index 51b671955..72bbc3b42 100644 --- a/src/main/browser/browser-guest-ui.ts +++ b/src/main/browser/browser-guest-ui.ts @@ -284,12 +284,10 @@ export function setupGuestShortcutForwarding(args: { if (input.code === 'KeyB' && input.shift) { renderer.send('ui:newBrowserTab') } else if (input.code === 'KeyT' && !input.shift) { - // Why: once focus is inside a browser guest, Cmd/Ctrl+T should extend - // the current browser workspace with another internal page instead of - // creating a sibling Orca terminal tab. The renderer still decides - // whether that means "new page in this workspace" or "new workspace" - // based on the current active surface. - renderer.send('ui:newBrowserTab') + // Why: Cmd/Ctrl+T always opens a new terminal in the central pane, + // even when focus is inside a browser guest. Cmd/Ctrl+Shift+B is the + // dedicated shortcut for new browser tabs. + renderer.send('ui:newTerminalTab') } else if (input.code === 'KeyL' && !input.shift) { // Why: the address bar lives in the renderer chrome, not the guest // page. Forward Cmd/Ctrl+L out of the guest so the active BrowserPane diff --git a/src/main/browser/browser-manager.test.ts b/src/main/browser/browser-manager.test.ts index 8fc225b78..b707c740d 100644 --- a/src/main/browser/browser-manager.test.ts +++ b/src/main/browser/browser-manager.test.ts @@ -1093,7 +1093,7 @@ describe('browserManager', () => { } expect(rendererSendMock).toHaveBeenNthCalledWith(1, 'ui:newBrowserTab') - expect(rendererSendMock).toHaveBeenNthCalledWith(2, 'ui:newBrowserTab') + expect(rendererSendMock).toHaveBeenNthCalledWith(2, 'ui:newTerminalTab') expect(rendererSendMock).toHaveBeenNthCalledWith(3, 'ui:closeActiveTab') expect(rendererSendMock).toHaveBeenNthCalledWith(4, 'ui:switchTab', 1) expect(rendererSendMock).toHaveBeenNthCalledWith(5, 'ui:switchTerminalTab', 1) diff --git a/src/renderer/src/components/Terminal.tsx b/src/renderer/src/components/Terminal.tsx index 665ddfd57..b05e04874 100644 --- a/src/renderer/src/components/Terminal.tsx +++ b/src/renderer/src/components/Terminal.tsx @@ -881,18 +881,13 @@ function Terminal(): React.JSX.Element | null { const isMac = navigator.userAgent.includes('Mac') const onKeyDown = (e: KeyboardEvent): void => { const mod = isMac ? e.metaKey : e.ctrlKey - // Why: when the browser workspace is the active surface, standard - // browser tab creation should stay inside that workspace. Reusing the - // same shortcut keeps Orca's embedded browser aligned with user - // expectations instead of unexpectedly mutating the outer tab strip. + // Why: Cmd/Ctrl+T always opens a new terminal, regardless of which + // surface is active. Browser-tab creation has its own shortcut + // (Cmd/Ctrl+Shift+B) so users have a predictable way to spawn a + // terminal from anywhere in the central pane. if (mod && e.key === 't' && !e.shiftKey && !e.repeat) { e.preventDefault() - const state = useAppStore.getState() - if (state.activeTabType === 'browser') { - handleNewBrowserTab() - } else { - handleNewTab() - } + handleNewTab() return }