Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(ok): Ctrl+` toggles the bottom dock; rename ⌘J to Show/Hide Bottom Dock (#3228)

serafin-garcia7ff1535908de
diff --git a/.changeset/ctrl-backtick-bottom-dock.md b/.changeset/ctrl-backtick-bottom-dock.md
new file mode 100644
index 000000000..2818735bb
--- /dev/null
+++ b/.changeset/ctrl-backtick-bottom-dock.md
@@ -0,0 +1,7 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+<kbd>Ctrl</kbd>+<kbd>`</kbd> now toggles the bottom dock, matching the chord VS Code and Zed both use for the terminal. It is literal Control on every platform (not <kbd>Cmd</kbd> on macOS, which the OS reserves for window cycling), it works from inside a focused terminal so you can dismiss the dock without reaching for the mouse, and it appears alongside <kbd>⌘</kbd><kbd>J</kbd> in Settings → Hotkeys. It shares <kbd>⌘</kbd><kbd>J</kbd>'s handler, so with text selected in the editor it stages that passage into the terminal rather than toggling.
+
+<kbd>⌘</kbd><kbd>J</kbd> is unchanged, but its command is renamed from "Show/Hide Terminal" to "Show/Hide Bottom Dock" in the View menu and the ⌘K palette — it toggles the dock, and the dock is where the terminal lives. Searching the palette for "terminal", "show terminal", or "hide terminal" still finds it.
diff --git a/docs/content/features/editor.mdx b/docs/content/features/editor.mdx
index 814a3fd08..87a3a9a7e 100644
--- a/docs/content/features/editor.mdx
+++ b/docs/content/features/editor.mdx
@@ -106,9 +106,9 @@ Hovering a code block reveals a toolbar above it with its own **Ask AI** button
## Terminal
-The desktop app has a built-in terminal: real login shells, docked in the editor window. Toggle it with `Cmd+J`, **View ▸ Show / Hide Terminal**, or the edge **Show terminal** tab that sits where you last closed it. It opens as a right-side column by default; buttons in its tab strip move it between the right column and the bottom dock or collapse it (sessions keep running), and the dock position is remembered.
+The desktop app has a built-in terminal: real login shells, docked in the editor window. Toggle it with `Cmd+J` or `` Ctrl+` `` (which also works from inside a focused terminal), **View ▸ Show / Hide Bottom Dock**, or the edge **Show terminal** tab that sits where you last closed it. It opens as the bottom dock; the collapse button in its tab strip hides it again, and sessions keep running while it is hidden.
-The terminal is also the editor's AI-chat surface: the **Show terminal** tab starts your default CLI when no session is open, and the tab strip's **New chat** split button opens another CLI tab — its dropdown switches CLI (the pick sticks, shared with the Ask AI composer) or opens a plain shell tab. With text selected in the editor, `Cmd+J` stages the passage into the active CLI's input (or opens a new CLI tab when none is running) instead of toggling, and `Cmd+Shift+J` always stages it into a new CLI tab — the passage sits in the input for you to add to, and nothing is submitted until you press Enter. **Terminal ▸ New Terminal Window** (see [Terminal menu](#terminal-menu)) opens a dedicated window with the same multi-session tabs, `Cmd+<number>` tab switching, and shells starting at the project root.
+The terminal is also the editor's AI-chat surface: the **Show terminal** tab starts your default CLI when no session is open, and the tab strip's **New chat** split button opens another CLI tab — its dropdown switches CLI (the pick sticks, shared with the Ask AI composer) or opens a plain shell tab. With text selected in the editor, `Cmd+J` and `` Ctrl+` `` both stage the passage into the active CLI's input (or open a new CLI tab when none is running) instead of toggling — they share one handler — and `Cmd+Shift+J` always stages it into a new CLI tab — the passage sits in the input for you to add to, and nothing is submitted until you press Enter. **Terminal ▸ New Terminal Window** (see [Terminal menu](#terminal-menu)) opens a dedicated window with the same multi-session tabs, `Cmd+<number>` tab switching, and shells starting at the project root.
Rename a tab by double-clicking it or pressing `F2`; the name you set pins over whatever title the running program reports, and clearing it falls back to that title. Reorder tabs by dragging, or move the active tab with `Cmd+Shift+←` / `Cmd+Shift+→` — untitled tabs keep a number that stays with their session as the strip is rearranged.
@@ -245,6 +245,7 @@ Keyboard shortcuts (use `Ctrl` on Windows / Linux in place of `Cmd`, unless the
| `Cmd+Option+M` | Toggle between the visual and source editors, keeping your place. |
| `Cmd+Option+E` | **View in source** — jump from the visual editor to the Markdown for the block at the cursor, centered and highlighted (visual editor only). |
| `Cmd+J` | Show / Hide the docked terminal (desktop app). With text selected, stages the passage into the AI CLI's input instead — nothing runs until you press Enter. |
+| `` Ctrl+` `` | Show / Hide the docked terminal too — the VS Code / Zed chord, literal `Ctrl` on every platform. Works even while a terminal holds focus. With text selected it stages the passage like `Cmd+J` instead of toggling. |
| `Cmd+Shift+J` | Open an additional terminal tab (desktop app). With text selected, stages the passage into the new tab's AI CLI input. |
| `Cmd+K` | Open the [command palette](#command-palette). |
| `Cmd+L` | Open and focus the [Ask AI](#ask-ai) composer (desktop app). |
@@ -292,7 +293,7 @@ Before the existing Zoom and Toggle Fullscreen items, the View menu gets:
| --- | --- | --- |
| **Show / Hide Sidebar** | `Cmd+Option+S` | Toggles the file sidebar (left). Label flips between Show and Hide based on current state, matching Finder. |
| **Show / Hide Document Panel** | `Cmd+Option+B` | Toggles the document panel (right). |
-| **Show / Hide Terminal** | `Cmd+J` | Toggles the docked terminal. With editor text selected, stages the selection into the AI CLI's input instead of toggling. |
+| **Show / Hide Bottom Dock** | `Cmd+J` | Toggles the docked terminal. With editor text selected, stages the selection into the AI CLI's input instead of toggling. (`` Ctrl+` `` toggles it too, though that chord has no menu accelerator.) |
| **Show Hidden Files** | `Cmd+Shift+.` | `appearance.sidebar.showHiddenFiles`; same toggle as the sidebar's right-click menu. |
| **Expand All** | (none) | Expands every folder in the tree. Hidden when nothing is collapsed. |
| **Collapse All** | (none) | Collapses every folder in the tree. Hidden when nothing is expanded. |
diff --git a/packages/app/src/components/CommandPalette.dom.test.tsx b/packages/app/src/components/CommandPalette.dom.test.tsx
index aa7c50c9d..b2cd1a9a4 100644
--- a/packages/app/src/components/CommandPalette.dom.test.tsx
+++ b/packages/app/src/components/CommandPalette.dom.test.tsx
@@ -1204,7 +1204,7 @@ describe('Cmd+K menu-parity backfill', () => {
);
await setQuery('hide terminal');
expect(screen.getByTestId('command-palette-toggle-terminal').textContent).toContain(
- 'Hide Terminal',
+ 'Hide Bottom Dock',
);
cleanup();
@@ -1216,10 +1216,34 @@ describe('Cmd+K menu-parity backfill', () => {
);
await setQuery('show terminal');
expect(screen.getByTestId('command-palette-toggle-terminal').textContent).toContain(
- 'Show Terminal',
+ 'Show Bottom Dock',
);
});
+ // The row's label ("Bottom Dock") doesn't contain the words users actually
+ // search for, so those live in the command's keywords instead.
+ // `matchesCommandQuery` joins label+keywords and substring-matches, so a
+ // multi-word query only resolves against a contiguous run — these are the
+ // queries that must keep finding the dock command.
+ test('AC5: the bottom-dock toggle stays reachable by its terminal-era queries', async () => {
+ setViewMenuState({ terminalVisible: false });
+ await renderPalette({ bridge: createBridge() });
+ for (const query of [
+ 'terminal',
+ 'show terminal',
+ 'hide terminal',
+ 'bottom dock',
+ 'toggle bottom dock',
+ 'shell',
+ ]) {
+ await setQuery(query);
+ expect(
+ screen.queryByTestId('command-palette-toggle-terminal'),
+ `query "${query}" should surface the bottom-dock toggle`,
+ ).not.toBeNull();
+ }
+ });
+
test('AC5: kill-terminal is search-visible only when a terminal is live', async () => {
setViewMenuState({ terminalLive: true });
await renderPalette({ bridge: createBridge() });
diff --git a/packages/app/src/components/EditorPane.dom.test.tsx b/packages/app/src/components/EditorPane.dom.test.tsx
index 8ebd5cea8..47c037106 100644
--- a/packages/app/src/components/EditorPane.dom.test.tsx
+++ b/packages/app/src/components/EditorPane.dom.test.tsx
@@ -573,7 +573,7 @@ describe('EditorPane session-panel wiring', () => {
await renderEditorPane();
expect(screen.getByTestId('terminal-dock').getAttribute('data-visible')).toBe('false');
- // Mount pushes terminalVisible:false so the View menu reads "Show Terminal".
+ // Mount pushes terminalVisible:false so the View menu reads "Show Bottom Dock".
// Both panels push on mount, so name the field rather than taking the last.
expect(desk.viewMenuPushes).toContainEqual({ terminalVisible: false });
@@ -857,6 +857,65 @@ describe('EditorPane session-panel wiring', () => {
expect(screen.getByTestId('terminal-dock').getAttribute('data-visible')).toBe('false');
});
+ // ⌃` is the dock's second chord. It carries no native accelerator (an Electron
+ // menu item holds only one), so unlike ⌘J the renderer keydown is its ONLY
+ // delivery path — on the one host where the terminal exists. If this listener
+ // ever returns to a blanket `window.okDesktop != null` early-return, ⌃` dies
+ // exactly where it is meant to work.
+ test('desktop: Ctrl+` toggles the dock (the renderer owns the chord the menu does not)', async () => {
+ const desk = makeOkDesktopStub();
+ (window as { okDesktop?: unknown }).okDesktop = desk.stub;
+ await renderEditorPane();
+
+ const dock = () => screen.getByTestId('terminal-dock');
+ expect(dock().getAttribute('data-visible')).toBe('false');
+
+ function pressCtrlBacktick(): KeyboardEvent {
+ const event = new KeyboardEvent('keydown', {
+ key: '`',
+ code: 'Backquote',
+ ctrlKey: true,
+ cancelable: true,
+ bubbles: true,
+ });
+ act(() => {
+ window.dispatchEvent(event);
+ });
+ return event;
+ }
+
+ expect(pressCtrlBacktick().defaultPrevented).toBe(true);
+ expect(dock().getAttribute('data-visible')).toBe('true');
+ // Toggles, per the VS Code / Zed convention — it does not open-only.
+ pressCtrlBacktick();
+ expect(dock().getAttribute('data-visible')).toBe('false');
+ });
+
+ // The other half of that gate: on desktop ⌘J arrives as an OS-captured menu
+ // accelerator that dispatches `toggle-terminal`. If the renderer ALSO acted on
+ // the keydown, one press would toggle twice — a net no-op that reads as a dead
+ // shortcut.
+ test('desktop: a Cmd/Ctrl+J keydown is left to the native menu (no double toggle)', async () => {
+ const desk = makeOkDesktopStub();
+ (window as { okDesktop?: unknown }).okDesktop = desk.stub;
+ await renderEditorPane();
+
+ const dock = () => screen.getByTestId('terminal-dock');
+ const init: KeyboardEventInit = { key: 'j', cancelable: true, bubbles: true };
+ if (isMacOS()) init.metaKey = true;
+ else init.ctrlKey = true;
+ const event = new KeyboardEvent('keydown', init);
+ act(() => {
+ window.dispatchEvent(event);
+ });
+
+ expect(event.defaultPrevented).toBe(false);
+ expect(dock().getAttribute('data-visible')).toBe('false');
+ // The menu path is the one that acts on desktop.
+ act(() => desk.dispatchMenuAction('toggle-terminal'));
+ expect(dock().getAttribute('data-visible')).toBe('true');
+ });
+
// With no selection AND no shell to spawn, ⌘J has nothing to do on the web
// host, so it must leave the browser's own ⌘J alone. It used to preventDefault
// and then hit a guard that can never be false — swallowing the chord for a
diff --git a/packages/app/src/components/EditorPane.tsx b/packages/app/src/components/EditorPane.tsx
index cdf554e09..ddb9539a1 100644
--- a/packages/app/src/components/EditorPane.tsx
+++ b/packages/app/src/components/EditorPane.tsx
@@ -24,7 +24,7 @@ import { useNoPushPermissionToast } from '@/hooks/use-no-push-permission-toast';
import { useWorktreeAutoSyncNotice } from '@/hooks/use-worktree-autosync-notice';
import { authPromptStore } from '@/lib/auth-prompt-store';
import { useConfigContext } from '@/lib/config-provider';
-import { matchesKeyboardShortcut } from '@/lib/keyboard-shortcuts';
+import { matchesKeyboardShortcut, matchesRendererShortcut } from '@/lib/keyboard-shortcuts';
import { subscribeLocalMenuAction } from '@/lib/local-menu-action-bus';
import { isOverlayLayerOpen } from '@/lib/overlay-layers';
import { recordTerminalOpened } from '@/lib/terminal-telemetry';
@@ -284,11 +284,11 @@ export function EditorPane({ onOpenSearch }: EditorPaneProps = {}) {
const sendSelectionToTerminalEvent = useEffectEvent(sendSelectionToTerminal);
const launchNewChatEvent = useEffectEvent(() => launchNewChat());
- // Bottom-terminal toggle, dual-wired like the DocPanel: on desktop the
- // View → Terminal item's ⌘J/Ctrl+J accelerator is OS-captured and dispatches
+ // Bottom-dock toggle, dual-wired like the DocPanel: on desktop the View →
+ // Bottom Dock item's ⌘J/Ctrl+J accelerator is OS-captured and dispatches
// `toggle-terminal`; the web host has no menu, so a window keydown stands in.
- // With a selection, ⌘J sends it to the terminal (reusing the active tab)
- // instead of toggling.
+ // With a selection, the chord sends it to the terminal (reusing the active
+ // tab) instead of toggling.
useEffect(() => {
return subscribeLocalMenuAction((action) => {
if (action === 'toggle-terminal') {
@@ -305,10 +305,14 @@ export function EditorPane({ onOpenSearch }: EditorPaneProps = {}) {
});
}, []);
+ // Unlike the ⌘L listener below, this one stays mounted on desktop: ⌃` carries
+ // no native accelerator, so the renderer is its only delivery path. ⌘J is
+ // filtered out there by `nativeMenuAccelerator` — the menu already dispatches
+ // it above, and acting on it here too would toggle twice.
useEffect(() => {
- if (window.okDesktop != null) return;
+ const hasNativeMenu = window.okDesktop != null;
function handleKeyDown(event: KeyboardEvent) {
- if (!matchesKeyboardShortcut(event, 'toggle-terminal-panel')) return;
+ if (!matchesRendererShortcut(event, 'toggle-terminal-panel', hasNativeMenu)) return;
if (isOverlayLayerOpen()) return;
// Claim the chord only when we will actually act on it. A selection send is
// the whole of ⌘J on a shell-less host; with no selection AND no shell there
@@ -322,16 +326,23 @@ export function EditorPane({ onOpenSearch }: EditorPaneProps = {}) {
event.preventDefault();
setTerminalVisible((visible) => !visible);
}
- // Capture phase so a focused xterm textarea can't swallow ⌘J first.
+ // Capture phase so a focused xterm textarea can't swallow the chord first —
+ // load-bearing for ⌃`, which has to dismiss the dock from inside the terminal.
window.addEventListener('keydown', handleKeyDown, { capture: true });
return () => window.removeEventListener('keydown', handleKeyDown, { capture: true });
}, [terminalAvailable]);
- // ⌘L / Ctrl+L toggles the agents panel. Same dual wiring as ⌘J — on desktop the
- // View menu item's accelerator is OS-captured and dispatches `toggle-agent-panel`
- // (handled above), so this window keydown is the web host's stand-in. Unlike ⌘J
- // it has no selection-send behavior: a selection goes to whichever panel the
- // user's preferred AI lives in, which the hosts arbitrate off ⌘J.
+ // ⌘L / Ctrl+L toggles the agents panel. On desktop the View menu item's
+ // accelerator is OS-captured and dispatches `toggle-agent-panel` (handled
+ // above), so this window keydown is the web host's stand-in. Unlike ⌘J it has
+ // no selection-send behavior: a selection goes to whichever panel the user's
+ // preferred AI lives in, which the hosts arbitrate off ⌘J.
+ //
+ // Skipping the desktop host wholesale stays correct only while EVERY binding
+ // of the shortcut is menu-delivered. Add one the menu cannot carry — an
+ // Electron menu item holds a single accelerator — and that binding becomes
+ // undeliverable on desktop, silently. The fix then is to stay mounted and
+ // filter by `matchesRendererShortcut`, as the bottom-dock listener above does.
useEffect(() => {
if (window.okDesktop != null) return;
function handleKeyDown(event: KeyboardEvent) {
@@ -419,7 +430,7 @@ export function EditorPane({ onOpenSearch }: EditorPaneProps = {}) {
}, [terminalVisible]);
// Reflect terminal visibility to main so the View menu label flips between
- // "Show Terminal" and "Hide Terminal". Gated on the dock-state restore so the
+ // "Show Bottom Dock" and "Hide Bottom Dock". Gated on the dock-state restore so the
// mount-initial `false` can't overwrite main's retained per-window visibility
// before the restore reads it (the reload re-expand depends on that value).
// The first push after the restore settles carries the restored — or
@@ -428,7 +439,7 @@ export function EditorPane({ onOpenSearch }: EditorPaneProps = {}) {
if (window.okDesktop == null) return;
if (!dockRestoreSettled) return;
// Mirror into the renderer store so the Cmd+K palette can show a
- // state-reflecting "Show/Hide terminal" label (bridge push is main-only).
+ // state-reflecting "Show/Hide Bottom Dock" label (bridge push is main-only).
// Deliberately behind BOTH gates, unlike the unconditional sibling mirrors
// in FileSidebar / EditorArea: publishing the mount-initial `false` before
// the restore settles would flash a wrong palette label on a window whose
diff --git a/packages/app/src/components/command-palette-commands.ts b/packages/app/src/components/command-palette-commands.ts
index 7d58e88a1..9c7efe63b 100644
--- a/packages/app/src/components/command-palette-commands.ts
+++ b/packages/app/src/components/command-palette-commands.ts
@@ -203,8 +203,8 @@ const PALETTE_COMMAND_LABELS = {
sidebarHide: msg`Hide sidebar`,
docPanelShow: msg`Show document panel`,
docPanelHide: msg`Hide document panel`,
- terminalShow: msg`Show Terminal`,
- terminalHide: msg`Hide Terminal`,
+ terminalShow: msg`Show Bottom Dock`,
+ terminalHide: msg`Hide Bottom Dock`,
agentPanelShow: msg`Show Agents`,
agentPanelHide: msg`Hide Agents`,
showHiddenFiles: msg`Show hidden files`,
diff --git a/packages/app/src/lib/command-menu-parity.test.ts b/packages/app/src/lib/command-menu-parity.test.ts
index f585164f0..da7b4efaf 100644
--- a/packages/app/src/lib/command-menu-parity.test.ts
+++ b/packages/app/src/lib/command-menu-parity.test.ts
@@ -102,8 +102,8 @@ const PALETTE_COMMAND_LABELS = new Set<string>([
'Hide sidebar',
'Show document panel',
'Hide document panel',
- 'Show Terminal',
- 'Hide Terminal',
+ 'Show Bottom Dock',
+ 'Hide Bottom Dock',
'Show Agents',
'Hide Agents',
'Show hidden files',
@@ -360,7 +360,7 @@ describe('command-menu parity ratchet', () => {
{ menuLabel: 'Settings', shortcutId: 'settings' },
{ menuLabel: 'Hide sidebar', shortcutId: 'toggle-files-sidebar' },
{ menuLabel: 'Hide document panel', shortcutId: 'toggle-document-panel' },
- { menuLabel: 'Hide Terminal', shortcutId: 'toggle-terminal-panel' },
+ { menuLabel: 'Hide Bottom Dock', shortcutId: 'toggle-terminal-panel' },
{ menuLabel: 'Hide Agents', shortcutId: 'toggle-agent-panel' },
];
@@ -631,11 +631,11 @@ describe('menu state-dependent rendering', () => {
const labels = new Set(leaves.map((leaf) => normalizeLabel(leaf.label)));
expect(labels.has('Show sidebar')).toBe(true);
expect(labels.has('Show document panel')).toBe(true);
- expect(labels.has('Show Terminal')).toBe(true);
+ expect(labels.has('Show Bottom Dock')).toBe(true);
// A flipped `visible ? hideKey : showKey` would leave the Hide variants here.
expect(labels.has('Hide sidebar')).toBe(false);
expect(labels.has('Hide document panel')).toBe(false);
- expect(labels.has('Hide Terminal')).toBe(false);
+ expect(labels.has('Hide Bottom Dock')).toBe(false);
});
test('Show/Hide toggles render the Hide variant when the panel is visible', () => {
diff --git a/packages/app/src/lib/keyboard-shortcuts.test.ts b/packages/app/src/lib/keyboard-shortcuts.test.ts
index 1ac627618..2df20e8ba 100644
--- a/packages/app/src/lib/keyboard-shortcuts.test.ts
+++ b/packages/app/src/lib/keyboard-shortcuts.test.ts
@@ -7,6 +7,7 @@ import {
KEYBOARD_SHORTCUTS,
type KeyboardShortcutId,
matchesKeyboardShortcut,
+ matchesRendererShortcut,
} from './keyboard-shortcuts';
describe('keyboard shortcut registry', () => {
@@ -245,6 +246,92 @@ describe('keyboard shortcut registry', () => {
).toBe(false);
});
+ test('matches the terminal-panel shortcut on Ctrl+` on both platforms', () => {
+ for (const platform of ['mac', 'windowsLinux'] as const) {
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: false, ctrlKey: true, altKey: false, key: '`', code: 'Backquote' },
+ 'toggle-terminal-panel',
+ platform,
+ ),
+ ).toBe(true);
+ }
+ // Cmd+` is macOS window-cycling, never ours — a `mod` matcher would steal it.
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: true, ctrlKey: false, altKey: false, key: '`', code: 'Backquote' },
+ 'toggle-terminal-panel',
+ 'mac',
+ ),
+ ).toBe(false);
+ // Bare backtick must keep typing a backtick.
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: false, ctrlKey: false, altKey: false, key: '`', code: 'Backquote' },
+ 'toggle-terminal-panel',
+ 'mac',
+ ),
+ ).toBe(false);
+ // Matching on `code` means a layout whose backtick key emits another
+ // character still toggles, and an unrelated key that emits "`" does not.
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: false, ctrlKey: true, altKey: false, key: '<', code: 'Backquote' },
+ 'toggle-terminal-panel',
+ 'mac',
+ ),
+ ).toBe(true);
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: false, ctrlKey: true, altKey: false, key: '`', code: 'IntlBackslash' },
+ 'toggle-terminal-panel',
+ 'mac',
+ ),
+ ).toBe(false);
+ });
+
+ test('⌘J stays bindings[0] so the menu-accelerator parity ratchet keeps matching', () => {
+ expect(formatShortcut('toggle-terminal-panel', 'mac')).toBe('⌘ J');
+ const terminalShortcut = KEYBOARD_SHORTCUTS.find((s) => s.id === 'toggle-terminal-panel');
+ expect(terminalShortcut?.bindings.map((binding) => binding.mac)).toEqual(['⌘ J', '⌃ `']);
+ });
+
+ test('matchesRendererShortcut drops menu-delivered chords only when a native menu exists', () => {
+ const cmdJ = { metaKey: true, ctrlKey: false, altKey: false, key: 'j' };
+ const ctrlBacktick = {
+ metaKey: false,
+ ctrlKey: true,
+ altKey: false,
+ key: '`',
+ code: 'Backquote',
+ };
+ // Desktop: the View menu accelerator already dispatches ⌘J, so the renderer
+ // must ignore it (acting on both would toggle twice) while still owning ⌃`,
+ // which has no accelerator and would otherwise be undeliverable on desktop.
+ expect(matchesRendererShortcut(cmdJ, 'toggle-terminal-panel', true, 'mac')).toBe(false);
+ expect(matchesRendererShortcut(ctrlBacktick, 'toggle-terminal-panel', true, 'mac')).toBe(true);
+ // Web: no menu bar, so the renderer owns every binding.
+ expect(matchesRendererShortcut(cmdJ, 'toggle-terminal-panel', false, 'mac')).toBe(true);
+ expect(matchesRendererShortcut(ctrlBacktick, 'toggle-terminal-panel', false, 'mac')).toBe(true);
+
+ // Windows/Linux: the native CmdOrCtrl+J accelerator resolves to Ctrl+J, so
+ // the same menu-vs-renderer split must hold there too — the double-fire
+ // guard is not mac-only. ⌃` carries no accelerator on any platform.
+ const ctrlJ = { metaKey: false, ctrlKey: true, altKey: false, key: 'j' };
+ expect(matchesRendererShortcut(ctrlJ, 'toggle-terminal-panel', true, 'windowsLinux')).toBe(
+ false,
+ );
+ expect(
+ matchesRendererShortcut(ctrlBacktick, 'toggle-terminal-panel', true, 'windowsLinux'),
+ ).toBe(true);
+ expect(matchesRendererShortcut(ctrlJ, 'toggle-terminal-panel', false, 'windowsLinux')).toBe(
+ true,
+ );
+ expect(
+ matchesRendererShortcut(ctrlBacktick, 'toggle-terminal-panel', false, 'windowsLinux'),
+ ).toBe(true);
+ });
+
test('formats the toggle-agent-panel shortcut as Cmd/Ctrl + L', () => {
expect(formatShortcut('toggle-agent-panel', 'mac')).toBe('⌘ L');
expect(formatShortcut('toggle-agent-panel', 'windowsLinux')).toBe('Ctrl L');
diff --git a/packages/app/src/lib/keyboard-shortcuts.ts b/packages/app/src/lib/keyboard-shortcuts.ts
index 44bc8820a..fed122dd6 100644
--- a/packages/app/src/lib/keyboard-shortcuts.ts
+++ b/packages/app/src/lib/keyboard-shortcuts.ts
@@ -46,6 +46,17 @@ export interface ShortcutBinding {
mac: string;
windowsLinux: string;
match?: PlatformShortcutMatch;
+ /**
+ * A native menu item's accelerator delivers this chord on the desktop host,
+ * so a renderer keydown listener must NOT also act on it there — the menu
+ * already dispatches the action and handling it twice toggles twice. Web
+ * hosts have no menu bar and act on every binding.
+ *
+ * Only set on bindings whose shortcut has a renderer listener that runs on
+ * desktop (see {@link matchesRendererShortcut}); a listener that skips the
+ * desktop host wholesale needs no per-binding flag.
+ */
+ nativeMenuAccelerator?: boolean;
}
export interface KeyboardShortcutDefinition {
@@ -194,14 +205,26 @@ const KEYBOARD_SHORTCUT_DEFINITIONS = [
{
id: 'toggle-terminal-panel',
category: 'general',
- title: msg`Show or hide terminal`,
- description: msg`Toggle the bottom terminal panel. With text selected, stage it for your preferred AI instead.`,
+ title: msg`Show or hide bottom dock`,
+ description: msg`Toggle the bottom dock, where the terminal lives. With text selected, stage it for your preferred AI instead.`,
scope: msg`OK Desktop`,
+ // ⌘J must stay bindings[0]: `formatShortcut` renders only the first binding,
+ // and the menu-accelerator parity ratchet compares that against the View
+ // menu's CmdOrCtrl+J. ⌃` is appended, never prepended.
bindings: [
{
mac: '⌘ J',
windowsLinux: 'Ctrl J',
match: { key: 'j', mod: true },
+ nativeMenuAccelerator: true,
+ },
+ {
+ // Literal Control on every platform — the chord VS Code and Zed both
+ // use — so `mod` (Cmd on macOS) would be the wrong modifier. Matching on
+ // `code` keeps it working on layouts that put backtick elsewhere.
+ mac: '⌃ `',
+ windowsLinux: 'Ctrl `',
+ match: { code: 'Backquote', ctrlKey: true },
},
],
},
@@ -1047,6 +1070,28 @@ export function matchesKeyboardShortcut(
});
}
+/**
+ * {@link matchesKeyboardShortcut} for renderer keydown listeners that stay
+ * mounted on the desktop host: when a native menu bar is present, bindings a
+ * menu accelerator already delivers are skipped, so only the chords the menu
+ * does NOT claim reach the renderer.
+ *
+ * A shortcut whose every binding is menu-delivered never matches on desktop —
+ * which is the same outcome as the listener not running there at all.
+ */
+export function matchesRendererShortcut(
+ event: ShortcutEventLike,
+ id: KeyboardShortcutId,
+ hasNativeMenu: boolean,
+ platform: ShortcutPlatform = currentShortcutPlatform(),
+): boolean {
+ return getShortcut(id).bindings.some((binding) => {
+ if (hasNativeMenu && binding.nativeMenuAccelerator === true) return false;
+ const match = resolveMatch(binding.match, platform);
+ return match ? matchesBinding(event, match, platform) : false;
+ });
+}
+
function resolveMatch(
match: PlatformShortcutMatch | undefined,
platform: ShortcutPlatform,
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 872555a4e..1e5e5d535 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -655,7 +655,6 @@
"9uI_rE": ["Undo"],
"9uRLEH": ["Couldn't open \"", ["name"], "\" — it isn't in the project's skills yet."],
"9wQrUU": ["Refactoring"],
- "9xCnv8": ["Hide Terminal"],
"9zb2WA": ["Connecting"],
"A1taO8": ["Search"],
"A50vr3": ["Use lowercase letters, digits, and <0>-</0> only."],
@@ -1481,6 +1480,9 @@
"NRSLBe": [["diffMin"], "m ago"],
"NSnIUP": ["Two-page (even)"],
"NUr4kz": ["A reusable starting point for new documents in this folder."],
+ "NVtrN-": [
+ "Toggle the bottom dock, where the terminal lives. With text selected, stage it for your preferred AI instead."
+ ],
"NYUhy5": ["Subfolder name"],
"NYn1cR": ["Loading editor"],
"NYu2Pt": ["New project…"],
@@ -2011,6 +2013,7 @@
"Wh0im4": ["editing [[", ["realCurrentDoc"], "]]"],
"WhOsNE": ["Strikethrough"],
"Wi-VWy": ["Couldn't send the report"],
+ "WiGqD8": ["Show Bottom Dock"],
"WkTLN7": ["Show only markdown files"],
"WkyP2p": ["Skills section"],
"WmPbvm": ["Get product updates in your inbox."],
@@ -2108,6 +2111,7 @@
"YJPN3F": ["Too slow"],
"YKLP_-": ["Template renamed"],
"YLMBSd": ["e.g. The editor froze after I pasted a large table"],
+ "YM5oO0": ["Show or hide bottom dock"],
"YPFBfr": [["detail"], " - ", ["kind"], " \"", ["createdPath"], "\" still exists on disk"],
"YRavYS": [
"A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
@@ -2464,7 +2468,6 @@
"dNM58w": ["Claude Code (claude) isn't installed or on your PATH."],
"dOHMA0": ["Failed to move"],
"dOxPd4": ["Footnote"],
- "dPOFid": ["Show or hide terminal"],
"dQHSCs": ["Convert (delete original)"],
"dTaauv": ["Reason: ", ["reason"]],
"dUQ7_J": [
@@ -2987,9 +2990,6 @@
") that won't touch the rest of your system."
],
"l7X_SM": ["Send to AI"],
- "l9HUtd": [
- "Toggle the bottom terminal panel. With text selected, stage it for your preferred AI instead."
- ],
"lAiyU_": ["Only the current document uses <0>#", ["tag"], "</0>."],
"lCC_D5": ["Subscribing..."],
"lGs_bQ": ["Page <0>*</0>"],
@@ -3257,6 +3257,7 @@
"pAgkuZ": ["Reopening \"", ["docName"], "\" with a fresh local collaboration cache."],
"pBROkv": ["Thanks for subscribing. Watch your inbox for product updates."],
"pCralD": ["Move to new pane left"],
+ "pDD2Hm": ["Hide Bottom Dock"],
"pEQFsW": ["No matching projects."],
"pFPzHA": ["Emoji picker"],
"pFRz_E": ["Leave these comments out of this message"],
@@ -3759,7 +3760,6 @@
"xeXS4P": ["Or use a starter pack"],
"xeiujy": ["Text"],
"xhlFsx": ["Inherited — set a value here to replace it."],
- "xi9KGG": ["Show Terminal"],
"xiv-dW": ["No files yet."],
"xlQpTE": ["More refusal options"],
"xloBjn": ["Relative Path"],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index d7ec739ca..4c5d05d25 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -5402,6 +5402,10 @@ msgstr "Hide advanced"
msgid "Hide Agents"
msgstr "Hide Agents"
+#: src/components/command-palette-commands.ts
+msgid "Hide Bottom Dock"
+msgstr "Hide Bottom Dock"
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
msgid "Hide document panel"
@@ -5464,10 +5468,6 @@ msgstr "Hide selection preview"
msgid "Hide sidebar"
msgstr "Hide sidebar"
-#: src/components/command-palette-commands.ts
-msgid "Hide Terminal"
-msgstr "Hide Terminal"
-
#: src/comments/comment-chips.tsx
msgid "Hide these comments"
msgstr "Hide these comments"
@@ -9801,6 +9801,10 @@ msgstr "Show advanced"
msgid "Show Agents"
msgstr "Show Agents"
+#: src/components/command-palette-commands.ts
+msgid "Show Bottom Dock"
+msgstr "Show Bottom Dock"
+
#: src/components/MermaidFileViewer.tsx
msgid "Show diagram"
msgstr "Show diagram"
@@ -9863,6 +9867,10 @@ msgstr "Show only markdown files"
msgid "Show or hide agents"
msgstr "Show or hide agents"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Show or hide bottom dock"
+msgstr "Show or hide bottom dock"
+
#: src/lib/keyboard-shortcuts.ts
msgid "Show or hide document panel"
msgstr "Show or hide document panel"
@@ -9871,10 +9879,6 @@ msgstr "Show or hide document panel"
msgid "Show or hide Files"
msgstr "Show or hide Files"
-#: src/lib/keyboard-shortcuts.ts
-msgid "Show or hide terminal"
-msgstr "Show or hide terminal"
-
#: src/components/AgentDiffPane.tsx
#: src/components/EditorToolbar.tsx
#: src/components/TimelineDiffPane.tsx
@@ -9911,10 +9915,6 @@ msgstr "Show sidebar"
msgid "Show source"
msgstr "Show source"
-#: src/components/command-palette-commands.ts
-msgid "Show Terminal"
-msgstr "Show Terminal"
-
#: src/comments/comment-chips.tsx
msgid "Show these comments"
msgstr "Show these comments"
@@ -11357,8 +11357,8 @@ msgid "Toggle strikethrough formatting."
msgstr "Toggle strikethrough formatting."
#: src/lib/keyboard-shortcuts.ts
-msgid "Toggle the bottom terminal panel. With text selected, stage it for your preferred AI instead."
-msgstr "Toggle the bottom terminal panel. With text selected, stage it for your preferred AI instead."
+msgid "Toggle the bottom dock, where the terminal lives. With text selected, stage it for your preferred AI instead."
+msgstr "Toggle the bottom dock, where the terminal lives. With text selected, stage it for your preferred AI instead."
#: src/lib/keyboard-shortcuts.ts
msgid "Toggle the left file sidebar."
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index d1ad8c45a..95541e1f5 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -655,7 +655,6 @@
"9uI_rE": ["Ũńďō"],
"9uRLEH": ["Ćōũĺďń'ţ ōƥēń \"", ["name"], "\" — ĩţ ĩśń'ţ ĩń ţĥē ƥŕōĴēćţ'ś śķĩĺĺś ŷēţ."],
"9wQrUU": ["Ŕēƒàćţōŕĩńĝ"],
- "9xCnv8": ["Ĥĩďē Ţēŕḿĩńàĺ"],
"9zb2WA": ["Ćōńńēćţĩńĝ"],
"A1taO8": ["Śēàŕćĥ"],
"A50vr3": ["Ũśē ĺōŵēŕćàśē ĺēţţēŕś, ďĩĝĩţś, àńď <0>-</0> ōńĺŷ."],
@@ -1481,6 +1480,9 @@
"NRSLBe": [["diffMin"], "ḿ àĝō"],
"NSnIUP": ["Ţŵō-ƥàĝē (ēvēń)"],
"NUr4kz": ["À ŕēũśàƀĺē śţàŕţĩńĝ ƥōĩńţ ƒōŕ ńēŵ ďōćũḿēńţś ĩń ţĥĩś ƒōĺďēŕ."],
+ "NVtrN-": [
+ "Ţōĝĝĺē ţĥē ƀōţţōḿ ďōćķ, ŵĥēŕē ţĥē ţēŕḿĩńàĺ ĺĩvēś. Ŵĩţĥ ţēxţ śēĺēćţēď, śţàĝē ĩţ ƒōŕ ŷōũŕ ƥŕēƒēŕŕēď ÀĨ ĩńśţēàď."
+ ],
"NYUhy5": ["Śũƀƒōĺďēŕ ńàḿē"],
"NYn1cR": ["Ĺōàďĩńĝ ēďĩţōŕ"],
"NYu2Pt": ["Ńēŵ ƥŕōĴēćţ…"],
@@ -2011,6 +2013,7 @@
"Wh0im4": ["ēďĩţĩńĝ [[", ["realCurrentDoc"], "]]"],
"WhOsNE": ["Śţŕĩķēţĥŕōũĝĥ"],
"Wi-VWy": ["Ćōũĺďń'ţ śēńď ţĥē ŕēƥōŕţ"],
+ "WiGqD8": ["Śĥōŵ ßōţţōḿ Ďōćķ"],
"WkTLN7": ["Śĥōŵ ōńĺŷ ḿàŕķďōŵń ƒĩĺēś"],
"WkyP2p": ["Śķĩĺĺś śēćţĩōń"],
"WmPbvm": ["Ĝēţ ƥŕōďũćţ ũƥďàţēś ĩń ŷōũŕ ĩńƀōx."],
@@ -2108,6 +2111,7 @@
"YJPN3F": ["Ţōō śĺōŵ"],
"YKLP_-": ["Ţēḿƥĺàţē ŕēńàḿēď"],
"YLMBSd": ["ē.ĝ. Ţĥē ēďĩţōŕ ƒŕōźē àƒţēŕ Ĩ ƥàśţēď à ĺàŕĝē ţàƀĺē"],
+ "YM5oO0": ["Śĥōŵ ōŕ ĥĩďē ƀōţţōḿ ďōćķ"],
"YPFBfr": [["detail"], " - ", ["kind"], " \"", ["createdPath"], "\" śţĩĺĺ ēxĩśţś ōń ďĩśķ"],
"YRavYS": [
"À ƥēŕśōńàĺ ćōĺōŕ-ţĥēḿē ƥĩćķēŕ — ńōţ śĥàŕēď ŵĩţĥ ŷōũŕ ƥŕōĴēćţ. Ŵĥēń ōń, ĩţ àƥƥēàŕś ũńďēŕ Ƥĺũĝĩńś ĩń ţĥē śĩďēƀàŕ."
@@ -2464,7 +2468,6 @@
"dNM58w": ["Ćĺàũďē Ćōďē (ćĺàũďē) ĩśń'ţ ĩńśţàĺĺēď ōŕ ōń ŷōũŕ ƤÀŢĤ."],
"dOHMA0": ["Ƒàĩĺēď ţō ḿōvē"],
"dOxPd4": ["Ƒōōţńōţē"],
- "dPOFid": ["Śĥōŵ ōŕ ĥĩďē ţēŕḿĩńàĺ"],
"dQHSCs": ["Ćōńvēŕţ (ďēĺēţē ōŕĩĝĩńàĺ)"],
"dTaauv": ["Ŕēàśōń: ", ["reason"]],
"dUQ7_J": [
@@ -2987,9 +2990,6 @@
") ţĥàţ ŵōń'ţ ţōũćĥ ţĥē ŕēśţ ōƒ ŷōũŕ śŷśţēḿ."
],
"l7X_SM": ["Śēńď ţō ÀĨ"],
- "l9HUtd": [
- "Ţōĝĝĺē ţĥē ƀōţţōḿ ţēŕḿĩńàĺ ƥàńēĺ. Ŵĩţĥ ţēxţ śēĺēćţēď, śţàĝē ĩţ ƒōŕ ŷōũŕ ƥŕēƒēŕŕēď ÀĨ ĩńśţēàď."
- ],
"lAiyU_": ["Ōńĺŷ ţĥē ćũŕŕēńţ ďōćũḿēńţ ũśēś <0>#", ["tag"], "</0>."],
"lCC_D5": ["Śũƀśćŕĩƀĩńĝ..."],
"lGs_bQ": ["Ƥàĝē <0>*</0>"],
@@ -3257,6 +3257,7 @@
"pAgkuZ": ["Ŕēōƥēńĩńĝ \"", ["docName"], "\" ŵĩţĥ à ƒŕēśĥ ĺōćàĺ ćōĺĺàƀōŕàţĩōń ćàćĥē."],
"pBROkv": ["Ţĥàńķś ƒōŕ śũƀśćŕĩƀĩńĝ. Ŵàţćĥ ŷōũŕ ĩńƀōx ƒōŕ ƥŕōďũćţ ũƥďàţēś."],
"pCralD": ["Ḿōvē ţō ńēŵ ƥàńē ĺēƒţ"],
+ "pDD2Hm": ["Ĥĩďē ßōţţōḿ Ďōćķ"],
"pEQFsW": ["Ńō ḿàţćĥĩńĝ ƥŕōĴēćţś."],
"pFPzHA": ["ĒḿōĴĩ ƥĩćķēŕ"],
"pFRz_E": ["Ĺēàvē ţĥēśē ćōḿḿēńţś ōũţ ōƒ ţĥĩś ḿēśśàĝē"],
@@ -3759,7 +3760,6 @@
"xeXS4P": ["Ōŕ ũśē à śţàŕţēŕ ƥàćķ"],
"xeiujy": ["Ţēxţ"],
"xhlFsx": ["Ĩńĥēŕĩţēď — śēţ à vàĺũē ĥēŕē ţō ŕēƥĺàćē ĩţ."],
- "xi9KGG": ["Śĥōŵ Ţēŕḿĩńàĺ"],
"xiv-dW": ["Ńō ƒĩĺēś ŷēţ."],
"xlQpTE": ["Ḿōŕē ŕēƒũśàĺ ōƥţĩōńś"],
"xloBjn": ["Ŕēĺàţĩvē Ƥàţĥ"],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 8eae387d6..6a948b889 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -5398,6 +5398,10 @@ msgstr ""
msgid "Hide Agents"
msgstr ""
+#: src/components/command-palette-commands.ts
+msgid "Hide Bottom Dock"
+msgstr ""
+
#: src/components/AppMenubar.tsx
#: src/components/command-palette-commands.ts
msgid "Hide document panel"
@@ -5460,10 +5464,6 @@ msgstr ""
msgid "Hide sidebar"
msgstr ""
-#: src/components/command-palette-commands.ts
-msgid "Hide Terminal"
-msgstr ""
-
#: src/comments/comment-chips.tsx
msgid "Hide these comments"
msgstr ""
@@ -9797,6 +9797,10 @@ msgstr ""
msgid "Show Agents"
msgstr ""
+#: src/components/command-palette-commands.ts
+msgid "Show Bottom Dock"
+msgstr ""
+
#: src/components/MermaidFileViewer.tsx
msgid "Show diagram"
msgstr ""
@@ -9860,15 +9864,15 @@ msgid "Show or hide agents"
msgstr ""
#: src/lib/keyboard-shortcuts.ts
-msgid "Show or hide document panel"
+msgid "Show or hide bottom dock"
msgstr ""
#: src/lib/keyboard-shortcuts.ts
-msgid "Show or hide Files"
+msgid "Show or hide document panel"
msgstr ""
#: src/lib/keyboard-shortcuts.ts
-msgid "Show or hide terminal"
+msgid "Show or hide Files"
msgstr ""
#: src/components/AgentDiffPane.tsx
@@ -9907,10 +9911,6 @@ msgstr ""
msgid "Show source"
msgstr ""
-#: src/components/command-palette-commands.ts
-msgid "Show Terminal"
-msgstr ""
-
#: src/comments/comment-chips.tsx
msgid "Show these comments"
msgstr ""
@@ -11353,7 +11353,7 @@ msgid "Toggle strikethrough formatting."
msgstr ""
#: src/lib/keyboard-shortcuts.ts
-msgid "Toggle the bottom terminal panel. With text selected, stage it for your preferred AI instead."
+msgid "Toggle the bottom dock, where the terminal lives. With text selected, stage it for your preferred AI instead."
msgstr ""
#: src/lib/keyboard-shortcuts.ts
diff --git a/packages/core/src/commands/command-identity.ts b/packages/core/src/commands/command-identity.ts
index 9212acb34..234f12f1a 100644
--- a/packages/core/src/commands/command-identity.ts
+++ b/packages/core/src/commands/command-identity.ts
@@ -577,7 +577,21 @@ export const COMMAND_IDENTITIES: readonly CommandIdentity[] = [
id: 'toggle-terminal',
menuActionId: 'toggle-terminal',
labelKey: 'terminalShow',
- keywords: ['terminal', 'shell', 'console', 'toggle'],
+ // The label says "Bottom Dock", not "terminal", so the terminal words have
+ // to live here or ⌘K search for the thing in the dock stops finding the
+ // dock. `matchesCommandQuery` substring-matches the query against
+ // label+keywords JOINED, so a multi-word query only hits a contiguous run:
+ // the phrases below are what keep "show terminal" / "hide terminal" queries
+ // working and admit Zed's own name for the command.
+ keywords: [
+ 'terminal',
+ 'shell',
+ 'console',
+ 'panel',
+ 'toggle bottom dock',
+ 'show terminal',
+ 'hide terminal',
+ ],
shortcutId: 'toggle-terminal-panel',
stateToggle: {
showKey: 'terminalShow',
diff --git a/packages/core/src/constants/menu-labels.ts b/packages/core/src/constants/menu-labels.ts
index 75ebcffe4..dcb70f9f9 100644
--- a/packages/core/src/constants/menu-labels.ts
+++ b/packages/core/src/constants/menu-labels.ts
@@ -98,8 +98,10 @@ export const MENU_LABELS = {
docPanelHide: 'Hide document panel',
back: 'Back',
forward: 'Forward',
- terminalShow: 'Show Terminal',
- terminalHide: 'Hide Terminal',
+ // Named for the surface, not its contents: ⌘J toggles the bottom dock, which
+ // currently hosts the terminal. The Terminal menu's own leaves stay terminal-named.
+ terminalShow: 'Show Bottom Dock',
+ terminalHide: 'Hide Bottom Dock',
agentPanelShow: 'Show Agents',
agentPanelHide: 'Hide Agents',
// Palette form for the install command, whose native-menu leaf renders a
diff --git a/packages/desktop/src/main/menu.ts b/packages/desktop/src/main/menu.ts
index 4b8b8ca78..300625f86 100644
--- a/packages/desktop/src/main/menu.ts
+++ b/packages/desktop/src/main/menu.ts
@@ -294,9 +294,9 @@ export interface MenuDeps {
docPanelVisible?: boolean;
onToggleDocPanel?(): void;
/**
- * Docked terminal-panel visibility — drives the View → Show/Hide Terminal
- * label. Unlike the sidebar/doc-panel (visible by default), the terminal
- * starts hidden, so `undefined`/`false` reads as "Show Terminal".
+ * Bottom-dock visibility — drives the View → Show/Hide Bottom Dock label.
+ * Unlike the sidebar/doc-panel (visible by default), the dock starts hidden,
+ * so `undefined`/`false` reads as "Show Bottom Dock".
*/
terminalVisible?: boolean;
onToggleTerminal?(): void;
diff --git a/packages/desktop/tests/main/menu.test.ts b/packages/desktop/tests/main/menu.test.ts
index 25768449e..5092befac 100644
--- a/packages/desktop/tests/main/menu.test.ts
+++ b/packages/desktop/tests/main/menu.test.ts
@@ -1196,62 +1196,65 @@ describe('buildMenuTemplate — View → Show/Hide sidebar', () => {
});
});
-describe('buildMenuTemplate — View → Show/Hide Terminal', () => {
- // The docked-terminal toggle mirrors the sidebar/doc-panel single-row pattern
- // but inverts the default: the terminal starts HIDDEN, so undefined/false
- // reads "Show Terminal" (the sidebar/doc-panel start visible, so they default
+describe('buildMenuTemplate — View → Show/Hide Bottom Dock', () => {
+ // The bottom-dock toggle mirrors the sidebar/doc-panel single-row pattern
+ // but inverts the default: the dock starts HIDDEN, so undefined/false reads
+ // "Show Bottom Dock" (the sidebar/doc-panel start visible, so they default
// to "Hide"). ⌘J / Ctrl+J is OS-captured before the renderer, matching the
// sidebar item's accelerator model.
- test('renders "Show Terminal" when terminalVisible is unset or false', () => {
+ test('renders "Show Bottom Dock" when terminalVisible is unset or false', () => {
const unsetDeps = buildMenuTemplate(makeDeps({ onToggleTerminal: vi.fn(() => {}) }));
- expect(findByLabel(unsetDeps, 'Show Terminal')).toBeDefined();
- expect(findByLabel(unsetDeps, 'Hide Terminal')).toBeUndefined();
+ expect(findByLabel(unsetDeps, 'Show Bottom Dock')).toBeDefined();
+ expect(findByLabel(unsetDeps, 'Hide Bottom Dock')).toBeUndefined();
const hidden = buildMenuTemplate(
makeDeps({ onToggleTerminal: vi.fn(() => {}), terminalVisible: false }),
);
- expect(findByLabel(hidden, 'Show Terminal')).toBeDefined();
- expect(findByLabel(hidden, 'Hide Terminal')).toBeUndefined();
+ expect(findByLabel(hidden, 'Show Bottom Dock')).toBeDefined();
+ expect(findByLabel(hidden, 'Hide Bottom Dock')).toBeUndefined();
});
- test('renders "Hide Terminal" when terminalVisible is true', () => {
+ test('renders "Hide Bottom Dock" when terminalVisible is true', () => {
const visible = buildMenuTemplate(
makeDeps({ onToggleTerminal: vi.fn(() => {}), terminalVisible: true }),
);
- expect(findByLabel(visible, 'Hide Terminal')).toBeDefined();
- expect(findByLabel(visible, 'Show Terminal')).toBeUndefined();
+ expect(findByLabel(visible, 'Hide Bottom Dock')).toBeDefined();
+ expect(findByLabel(visible, 'Show Bottom Dock')).toBeUndefined();
});
test('Terminal binds CmdOrCtrl+J accelerator (⌘J on macOS, VS Code panel convention)', () => {
// Pinned because ⌘J / Ctrl+J is the muscle-memory affordance for the bottom
// panel (VS Code parity); ⌘` is macOS window-cycling. A refactor that drops
// or rebinds the accelerator silently breaks that affordance.
+ // The dock's second chord, ⌃`, deliberately carries NO accelerator: it is
+ // renderer-delivered, and a menu item may hold only one. ⌃` is also distinct
+ // from the ⌘` this comment warns about — Control, not Command.
const hidden = buildMenuTemplate(makeDeps({ onToggleTerminal: vi.fn(() => {}) }));
- expect(findByLabel(hidden, 'Show Terminal')?.accelerator).toBe('CmdOrCtrl+J');
+ expect(findByLabel(hidden, 'Show Bottom Dock')?.accelerator).toBe('CmdOrCtrl+J');
const visible = buildMenuTemplate(
makeDeps({ onToggleTerminal: vi.fn(() => {}), terminalVisible: true }),
);
- expect(findByLabel(visible, 'Hide Terminal')?.accelerator).toBe('CmdOrCtrl+J');
+ expect(findByLabel(visible, 'Hide Bottom Dock')?.accelerator).toBe('CmdOrCtrl+J');
});
test('Terminal DISABLED when toggle handler missing (unit-test default)', () => {
const template = buildMenuTemplate(makeDeps());
- expect(findByLabel(template, 'Show Terminal')?.enabled).toBe(false);
+ expect(findByLabel(template, 'Show Bottom Dock')?.enabled).toBe(false);
});
test('Terminal click dispatches deps.onToggleTerminal', () => {
const onToggleTerminal = vi.fn(() => {});
const template = buildMenuTemplate(makeDeps({ onToggleTerminal }));
- (findByLabel(template, 'Show Terminal')?.click as (() => void) | undefined)?.();
+ (findByLabel(template, 'Show Bottom Dock')?.click as (() => void) | undefined)?.();
expect(onToggleTerminal).toHaveBeenCalledTimes(1);
const onToggleTerminal2 = vi.fn(() => {});
const visible = buildMenuTemplate(
makeDeps({ onToggleTerminal: onToggleTerminal2, terminalVisible: true }),
);
- (findByLabel(visible, 'Hide Terminal')?.click as (() => void) | undefined)?.();
+ (findByLabel(visible, 'Hide Bottom Dock')?.click as (() => void) | undefined)?.();
expect(onToggleTerminal2).toHaveBeenCalledTimes(1);
});
@@ -1263,7 +1266,7 @@ describe('buildMenuTemplate — View → Show/Hide Terminal', () => {
const sub = view?.submenu as MenuItemConstructorOptions[] | undefined;
const labels = sub?.map((i) => i.label ?? `[role:${i.role ?? 'sep'}]`) ?? [];
const docPanelIdx = labels.indexOf('Hide document panel');
- const terminalIdx = labels.indexOf('Show Terminal');
+ const terminalIdx = labels.indexOf('Show Bottom Dock');
const resetZoomIdx = labels.indexOf('[role:resetZoom]');
expect(terminalIdx).toBeGreaterThan(docPanelIdx);
expect(resetZoomIdx).toBeGreaterThan(terminalIdx);
@@ -1299,7 +1302,7 @@ describe('buildMenuTemplate — View → Show/Hide Agents', () => {
makeDeps({ onToggleAgentPanel: vi.fn(() => {}), onToggleTerminal: vi.fn(() => {}) }),
);
expect(findByLabel(template, 'Show Agents')?.accelerator).toBe('CmdOrCtrl+L');
- expect(findByLabel(template, 'Show Terminal')?.accelerator).toBe('CmdOrCtrl+J');
+ expect(findByLabel(template, 'Show Bottom Dock')?.accelerator).toBe('CmdOrCtrl+J');
});
test('Agents click dispatches deps.onToggleAgentPanel', () => {
@@ -1326,7 +1329,7 @@ describe('buildMenuTemplate — View → Show/Hide Agents', () => {
}),
);
expect(findByLabel(template, 'Show Agents')?.enabled).toBe(true);
- expect(findByLabel(template, 'Show Terminal')?.enabled).toBe(false);
+ expect(findByLabel(template, 'Show Bottom Dock')?.enabled).toBe(false);
});
test('Agents follows the Terminal toggle in the View panel cluster', () => {
@@ -1335,13 +1338,13 @@ describe('buildMenuTemplate — View → Show/Hide Agents', () => {
);
const sub = findByLabel(template, 'View')?.submenu as MenuItemConstructorOptions[] | undefined;
const labels = sub?.map((i) => i.label ?? `[role:${i.role ?? 'sep'}]`) ?? [];
- expect(labels.indexOf('Show Agents')).toBeGreaterThan(labels.indexOf('Show Terminal'));
+ expect(labels.indexOf('Show Agents')).toBeGreaterThan(labels.indexOf('Show Bottom Dock'));
});
});
describe('buildMenuTemplate — top-level Terminal menu (New / Kill)', () => {
// VS Code-style top-level Terminal menu, placed between View and Window. The
- // View → Show/Hide Terminal toggle is kept too (⌘J muscle memory); this menu
+ // View → Show/Hide Bottom Dock toggle is kept too (⌘J muscle memory); this menu
// is the discoverable home. New Terminal is click-only (no accelerator — ⌘J
// belongs to the View toggle); Kill Terminal gates on a live session.
@@ -1370,7 +1373,7 @@ describe('buildMenuTemplate — top-level Terminal menu (New / Kill)', () => {
'New Terminal Window',
'Kill Terminal',
]);
- // No accelerator: ⌘J belongs to the View → Show/Hide Terminal toggle, so
+ // No accelerator: ⌘J belongs to the View → Show/Hide Bottom Dock toggle, so
// advertising it here too would only mislabel this item.
expect(findByLabel(template, 'New Terminal')?.accelerator).toBeUndefined();
});
@@ -1403,9 +1406,9 @@ describe('buildMenuTemplate — top-level Terminal menu (New / Kill)', () => {
expect(onKillTerminal).toHaveBeenCalledTimes(1);
});
- test('the View → Show/Hide Terminal toggle is preserved alongside the Terminal menu', () => {
+ test('the View → Show/Hide Bottom Dock toggle is preserved alongside the Terminal menu', () => {
const template = buildMenuTemplate(makeDeps({ onToggleTerminal: vi.fn(() => {}) }));
- expect(findByLabel(template, 'Show Terminal')).toBeDefined();
+ expect(findByLabel(template, 'Show Bottom Dock')).toBeDefined();
expect(findByLabel(template, 'Terminal')).toBeDefined();
});
});
diff --git a/packages/desktop/tests/smoke/terminal-dock.e2e.ts b/packages/desktop/tests/smoke/terminal-dock.e2e.ts
index 600e7ea93..dc92cc412 100644
--- a/packages/desktop/tests/smoke/terminal-dock.e2e.ts
+++ b/packages/desktop/tests/smoke/terminal-dock.e2e.ts
@@ -203,7 +203,7 @@ async function findEditorWindow(app: ElectronApplication, timeoutMs = 25_000): P
return page;
}
-/** Click the View → Show/Hide Terminal application-menu item (real toggle path
+/** Click the View → Show/Hide Bottom Dock application-menu item (real toggle path
* on desktop — ⌘J is its OS-captured accelerator). Returns the item label. */
async function clickViewTerminalItem(app: ElectronApplication): Promise<string | false> {
return app.evaluate(async ({ Menu }) => {
@@ -211,7 +211,7 @@ async function clickViewTerminalItem(app: ElectronApplication): Promise<string |
if (!menu) return false;
const view = menu.items.find((i) => i.label === 'View');
const item = view?.submenu?.items.find(
- (i) => i.label === 'Show Terminal' || i.label === 'Hide Terminal',
+ (i) => i.label === 'Show Bottom Dock' || i.label === 'Hide Bottom Dock',
);
if (!item) return false;
const label = item.label;
@@ -225,7 +225,7 @@ async function viewTerminalLabel(app: ElectronApplication): Promise<string | nul
const menu = Menu.getApplicationMenu();
const view = menu?.items.find((i) => i.label === 'View');
const item = view?.submenu?.items.find(
- (i) => i.label === 'Show Terminal' || i.label === 'Hide Terminal',
+ (i) => i.label === 'Show Bottom Dock' || i.label === 'Hide Bottom Dock',
);
return item?.label ?? null;
});
@@ -244,7 +244,7 @@ async function openTerminal(app: ElectronApplication, page: Page): Promise<void>
// Fail loud when the menu item is missing — otherwise the click silently
// no-ops and the failure surfaces 15s later as an unrelated-looking
// "Terminal section not visible" timeout.
- expect(clicked, 'View menu should expose a Show/Hide Terminal item').not.toBe(false);
+ expect(clicked, 'View menu should expose a Show/Hide Bottom Dock item').not.toBe(false);
await expect(terminalSection(page)).toBeVisible({ timeout: 15_000 });
}
@@ -381,13 +381,13 @@ test.describe('Docked terminal — live Electron', () => {
captureStderrFor(app, { cleanupDirs: [s.tmpHome, s.projectDir] });
const page = await findEditorWindow(app);
- expect(await viewTerminalLabel(app)).toBe('Show Terminal');
+ expect(await viewTerminalLabel(app)).toBe('Show Bottom Dock');
await clickViewTerminalItem(app);
await expect(terminalSection(page)).toBeVisible({ timeout: 15_000 });
- await expect.poll(() => viewTerminalLabel(app), { timeout: 8_000 }).toBe('Hide Terminal');
+ await expect.poll(() => viewTerminalLabel(app), { timeout: 8_000 }).toBe('Hide Bottom Dock');
await clickViewTerminalItem(app);
- await expect.poll(() => viewTerminalLabel(app), { timeout: 8_000 }).toBe('Show Terminal');
+ await expect.poll(() => viewTerminalLabel(app), { timeout: 8_000 }).toBe('Show Bottom Dock');
});
// Toggle completes within the perceptual-instant budget.
@@ -541,7 +541,7 @@ test.describe('Docked terminal — live Electron', () => {
// Escape is delivered to the terminal (NOT swallowed): terminal apps
// (vim, the `claude` TUI) need it. The no-keyboard-trap exit (WCAG 2.1.2) is
- // ⌘J — the View → Hide Terminal toggle — which collapses the dock and returns
+ // ⌘J — the View → Hide Bottom Dock toggle — which collapses the dock and returns
// focus to the editor.
test('QA-019 Escape reaches the terminal; ⌘J is the no-trap exit', async ({
captureStderrFor,
@@ -577,6 +577,44 @@ test.describe('Docked terminal — live Electron', () => {
await expect.poll(focusInTerminal).toBe(false);
});
+ // ⌃` is the dock's second chord and the only one the RENDERER delivers on
+ // desktop — ⌘J is an OS-captured menu accelerator, and a menu item may hold
+ // only one. That makes this the case no unit test can stand in for: the
+ // listener is capture-phase on `window` precisely so a focused xterm's hidden
+ // textarea cannot consume the chord first. If it ever regressed to bubble
+ // phase, or the listener went back to skipping the desktop host, the dock
+ // would become a keyboard trap for this chord — you could open it and never
+ // close it without the mouse.
+ test('Ctrl+` collapses the dock from inside a focused terminal', async ({ captureStderrFor }) => {
+ const s = seed('ctrl-backtick', { consent: true });
+ track(s.tmpHome, s.projectDir);
+ const app = await launchApp(s, { restrictPath: true });
+ captureStderrFor(app, { cleanupDirs: [s.tmpHome, s.projectDir] });
+ const page = await findEditorWindow(app);
+ await openTerminal(app, page);
+ await waitForStatus(page, 'running', 25_000);
+
+ const focusInTerminal = () =>
+ page.evaluate(() => {
+ const sec = document.querySelector('section[aria-label="Terminal"]');
+ return sec?.contains(document.activeElement) ?? false;
+ });
+
+ await page.locator('section[aria-label="Terminal"] .xterm').click();
+ await expect.poll(focusInTerminal).toBe(true);
+ expect(await viewTerminalLabel(app)).toBe('Hide Bottom Dock');
+
+ // The chord under test, pressed with the pty holding focus.
+ await page.keyboard.press('Control+Backquote');
+ await expect.poll(() => viewTerminalLabel(app), { timeout: 8_000 }).toBe('Show Bottom Dock');
+ await expect.poll(focusInTerminal).toBe(false);
+
+ // It toggles rather than open-only (VS Code / Zed convention), so the same
+ // chord brings the dock back.
+ await page.keyboard.press('Control+Backquote');
+ await expect.poll(() => viewTerminalLabel(app), { timeout: 8_000 }).toBe('Hide Bottom Dock');
+ });
+
// Collapsed panel is inert and focus returns to the editor on collapse.
test('QA-021 collapsed panel is inert and focus returns on collapse', async ({
captureStderrFor,
diff --git a/packages/desktop/tests/smoke/terminal-links.e2e.ts b/packages/desktop/tests/smoke/terminal-links.e2e.ts
index 3dc68f92c..8244e5065 100644
--- a/packages/desktop/tests/smoke/terminal-links.e2e.ts
+++ b/packages/desktop/tests/smoke/terminal-links.e2e.ts
@@ -119,10 +119,10 @@ async function openRunningTerminal(app: ElectronApplication, page: Page): Promis
const label = await app.evaluate(async ({ Menu }) => {
const view = Menu.getApplicationMenu()?.items.find((i) => i.label === 'View');
const item = view?.submenu?.items.find(
- (i) => i.label === 'Show Terminal' || i.label === 'Hide Terminal',
+ (i) => i.label === 'Show Bottom Dock' || i.label === 'Hide Bottom Dock',
);
if (!item) return false;
- if (item.label === 'Show Terminal') item.click();
+ if (item.label === 'Show Bottom Dock') item.click();
return item.label;
});
expect(label).toBeTruthy();
diff --git a/packages/desktop/tests/smoke/terminal-tabs.e2e.ts b/packages/desktop/tests/smoke/terminal-tabs.e2e.ts
index f10f8aceb..e22561495 100644
--- a/packages/desktop/tests/smoke/terminal-tabs.e2e.ts
+++ b/packages/desktop/tests/smoke/terminal-tabs.e2e.ts
@@ -114,7 +114,7 @@ async function clickViewTerminalItem(app: ElectronApplication): Promise<void> {
await app.evaluate(async ({ Menu }) => {
const view = Menu.getApplicationMenu()?.items.find((i) => i.label === 'View');
const item = view?.submenu?.items.find(
- (i) => i.label === 'Show Terminal' || i.label === 'Hide Terminal',
+ (i) => i.label === 'Show Bottom Dock' || i.label === 'Hide Bottom Dock',
);
item?.click();
});