Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(keybindings): registry-driven shortcuts panel and tooltips
enes97f617081423
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex a328ace5f..27d006b3a 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -179,7 +179,7 @@ import {type GlobalKeydownDeps} from '../lib/globalKeybindings'import type { ContextElement } from '../lib/keyContext'-import { activeKeybindingOverrides } from '../lib/keybindingOverrides'+import { activeKeybindingOverrides, chipFor, commandTooltip } from '../lib/keybindingOverrides'import { UsageIndicator } from '../components/UsageIndicator'import { SystemResourcePill } from '../components/SystemResourcePill'import { PresenceLayer } from '../components/PresenceLayer'@@ -262,7 +262,6 @@ import {} from '@shared/worktree'import { normWorktreePath, type BoundGroup } from '@shared/worktree-reconcile'import { boundGroups, scmScopes, defaultScmScope, selectedScmGroupId } from '@shared/scm-scope'-import { hintLabel } from '@shared/platform-utils'import {canvasImageFiles,canvasImageSink,@@ -9164,6 +9163,11 @@ export function Canvas() {[paletteOpen, buildCommands, nodes])+ // The palette's chord appears as a bare chip in two places (the cluster's search button and the+ // empty-canvas hint). Empty means the user unbound it: the chip is dropped rather than rendered+ // as an empty <kbd>, and the hint's sentence loses that clause with it.+ const paletteChip = chipFor('app.commandPalette')+return (<div className="canvas-root"><TabBar@@ -9357,7 +9361,7 @@ export function Canvas() {onMouseEnter={openSessionsPeek}onMouseLeave={closeSessionsPeekSoon}>- <button title={hintLabel('Sessions (⌘⇧L)')} onClick={onSessionsIconClick}>+ <button title={commandTooltip('Sessions', 'panel.sessions')} onClick={onSessionsIconClick}><IconSessions /></button></div>@@ -9375,12 +9379,12 @@ export function Canvas() {onClick={() => setPaletteOpen(true)}><span className="cluster-search__icon">⌕</span>- <span className="kbd">{hintLabel('⌘K')}</span>+ {paletteChip && <span className="kbd">{paletteChip}</span>}</button>- <button title={hintLabel('Explorer (⌘⇧E)')} onClick={() => setExplorerOpen(true)}>+ <button title={commandTooltip('Explorer', 'panel.explorer')} onClick={() => setExplorerOpen(true)}><IconExplorer /></button>- <button title={hintLabel('Source Control (⌘⇧G)')} onClick={() => setScOpen(true)}>+ <button title={commandTooltip('Source Control', 'panel.sourceControl')} onClick={() => setScOpen(true)}><IconBranch /></button><button@@ -9393,7 +9397,7 @@ export function Canvas() {<IconPhone /></button><button- title={hintLabel('Settings (⌘,)')}+ title={commandTooltip('Settings', 'app.settings')}onClick={() => {setSettingsSection(undefined)setSettingsOpen(true)@@ -9410,7 +9414,7 @@ export function Canvas() {x: Math.max(8, r.right - 220),y: r.bottom + 6,items: [- { label: 'Keyboard shortcuts', hint: hintLabel('⌘/'), onClick: () => setShortcutsOpen(true) },+ { label: 'Keyboard shortcuts', hint: chipFor('app.shortcutsPanel') || undefined, onClick: () => setShortcutsOpen(true) },{ label: 'Report a bug…', onClick: () => setBugReportOpen(true) },{label: 'Documentation',@@ -9442,7 +9446,7 @@ export function Canvas() {<div className="empty-canvas-hint" aria-hidden><div>Right-click to add a terminal or agent</div><div>- <span className="kbd">{hintLabel('⌘K')}</span> command palette · <span className="kbd">+</span> in the dock below+ {paletteChip && <><span className="kbd">{paletteChip}</span> command palette · </>}<span className="kbd">+</span> in the dock below</div></div>)}diff --git a/src/renderer/components/Dock.tsx b/src/renderer/components/Dock.tsxindex fdb7a27ce..9d4f87d01 100644--- a/src/renderer/components/Dock.tsx+++ b/src/renderer/components/Dock.tsx@@ -3,7 +3,7 @@ import { AGENT_CONFIG, BUILTIN_AGENT_IDS, type AgentId, type BuiltinAgentId } frimport type { CustomAgent } from '@shared/types'import { formatShortcut, isHoldChord } from '@shared/shortcut'import { hasSpeechModel } from '@shared/speech'-import { hintLabel } from '@shared/platform-utils'+import { commandTooltip } from '../lib/keybindingOverrides'import { AgentIcon } from '../lib/agentIcons'import { useSettings } from '../state/settings'import { useProjects } from '../state/projects'@@ -281,10 +281,10 @@ export function Dock({<span className="dock-sep" />- <button className="dock-btn" title={hintLabel('Undo (⌘Z)')} disabled={!canUndo} onClick={onUndo}>+ <button className="dock-btn" title={commandTooltip('Undo', 'canvas.undo')} disabled={!canUndo} onClick={onUndo}><UndoIcon /></button>- <button className="dock-btn" title={hintLabel('Redo (⌘⇧Z)')} disabled={!canRedo} onClick={onRedo}>+ <button className="dock-btn" title={commandTooltip('Redo', 'canvas.redo')} disabled={!canRedo} onClick={onRedo}><RedoIcon /></button>diff --git a/src/renderer/components/ShortcutsPanel.tsx b/src/renderer/components/ShortcutsPanel.tsxindex 7c799af05..2c6d3af17 100644--- a/src/renderer/components/ShortcutsPanel.tsx+++ b/src/renderer/components/ShortcutsPanel.tsx@@ -1,7 +1,9 @@import { useEffect } from 'react'import { createPortal } from 'react-dom'import { isHoldChord, shortcutKeyParts } from '@shared/shortcut'+import type { CommandId } from '@shared/keybindings'import { isBrowserRuntime } from '../bridge/runtime'+import { commandKeys } from '../lib/keybindingOverrides'import { useSettings } from '../state/settings'const isMac = /Mac/i.test(navigator.platform || navigator.userAgent)@@ -16,31 +18,44 @@ interface Row {label: string}-/** Everything but "Dictate" is fixed; that row's keys/label depend on `settings.speech.shortcut`- * (a modifier-only chord is hold-to-talk — no trailing key badge, so the label spells that out),- * so the sections are built at render time instead of module scope. */+/** Registry rows derive their keys from the effective binding, so a remap in settings.json+ * shows up here without touching this file — and a command the user unbound (or that ships+ * unassigned) drops off the panel instead of advertising a chord that no longer fires.+ * Gesture/mouse rows stay literal: they are not commands and the registry knows nothing+ * about them. "Dictate" also stays literal — its chord still lives in+ * `settings.speech.shortcut` (the registry's `speech.dictation` row is display-only for now),+ * and a modifier-only chord is hold-to-talk, which the label spells out. */function buildSections(dictationKeys: string[], dictationLabel: string): { title: string; rows: Row[] }[] {+ const cmd = (id: CommandId, label: string): Row[] => {+ const keys = commandKeys(id)+ return keys.length ? [{ keys, label }] : []+ }return [{title: 'General',rows: [- { keys: ['⌘', 'K'], label: 'Command palette' },- { keys: ['⌘', ','], label: 'Settings' },- { keys: ['⌘', '/'], label: 'This shortcuts panel' },+ ...cmd('app.commandPalette', 'Command palette'),+ ...cmd('app.settings', 'Settings'),+ ...cmd('app.shortcutsPanel', 'This shortcuts panel'),+ ...cmd('panel.explorer', 'Explorer'),+ ...cmd('panel.sourceControl', 'Source Control'),+ ...cmd('view.kanbanToggle', 'Kanban board'),+ ...cmd('panel.sessions', 'Pin the sessions sidebar'),// Desktop only: browsers own Cmd/Ctrl+1-9 for tab switching and a page cannot take it// back, so listing it in the Server Edition would promise a shortcut that never fires....(isBrowserRuntime() ? [] : [{ keys: ['⌘', '1-9'], label: 'Jump to project' }]),{ keys: dictationKeys, label: dictationLabel },- { keys: ['⌘', 'Z'], label: 'Undo' },- { keys: ['⌘', '⇧', 'Z'], label: 'Redo' }+ ...cmd('canvas.undo', 'Undo'),+ ...cmd('canvas.redo', 'Redo')]},{title: 'Canvas',rows: [- { keys: ['⌘', 'T'], label: 'New terminal' },- { keys: ['⌘', '⇧', 'C'], label: 'New Claude Code' },- { keys: ['⌘', 'W'], label: 'Close selected node' },+ ...cmd('node.newTerminal', 'New terminal'),+ ...cmd('node.newAgent', 'New Claude Code'),+ ...cmd('node.close', 'Close selected node'),+ ...cmd('canvas.deleteSelection', 'Delete selection'),{ keys: ['Right-click'], label: 'Actions menu (empty space or node)' },{ keys: ['Left-drag'], label: 'Box-select (touch to select)' },{ keys: ['Middle / Right-drag'], label: 'Pan the canvas' },@@ -60,7 +75,8 @@ function buildSections(dictationKeys: string[], dictationLabel: string): { titlerows: [{ keys: ['Hover ~0.6s'], label: 'Enter the terminal (type/select)' },{ keys: ['Quick drag'], label: 'Move the terminal (before it focuses)' },- { keys: ['⌘', 'M'], label: 'Toggle markdown view' },+ ...cmd('node.toggleMarkdown', 'Toggle markdown view'),+ ...cmd('terminal.find', 'Find in terminal'),{ keys: ['⌘', 'C'], label: 'Copy selection (markdown view)' },{ keys: ['✦'], label: 'Name the terminal with AI' }]@@ -68,8 +84,8 @@ function buildSections(dictationKeys: string[], dictationLabel: string): { title{title: 'Source Control',rows: [- { keys: ['⌘', '⇧', 'G'], label: 'Open Source Control' },- { keys: ['⌘', '↵'], label: 'Commit the staged changes' }+ ...cmd('panel.sourceControl', 'Open Source Control'),+ ...cmd('scm.commit', 'Commit the staged changes')]}]diff --git a/src/renderer/components/SourceControlPanel.tsx b/src/renderer/components/SourceControlPanel.tsxindex d0654f4da..bdbde8721 100644--- a/src/renderer/components/SourceControlPanel.tsx+++ b/src/renderer/components/SourceControlPanel.tsx@@ -16,7 +16,7 @@ import { buildCommitMenuItems } from './git-history/git-history-menu'import { ContextMenu, type MenuItem } from './ContextMenu'import { PublishDialog } from './PublishDialog'import { defaultScmScope, type ScmScope } from '@shared/scm-scope'-import { hintLabel } from '@shared/platform-utils'+import { chipFor } from '../lib/keybindingOverrides'export interface SourceControlPanelProps {onClose: () => void@@ -404,6 +404,10 @@ export function SourceControlPanel({)}+ // Whatever Commit is bound to; '' when unbound, in which case the box is just "Message" —+ // the button below it still commits.+ const commitChip = chipFor('scm.commit')+return createPortal(<div className="drawer-overlay" onClick={onClose}><aside className="drawer scm" onClick={(e) => e.stopPropagation()}>@@ -503,7 +507,7 @@ export function SourceControlPanel({<div className="scm-compose"><textareaclassName="scm-message"- placeholder={hintLabel('Message (⌘↵ to commit)')}+ placeholder={commitChip ? `Message (${commitChip} to commit)` : 'Message'}value={message}onChange={(e) => setMessage(e.target.value)}onKeyDown={(e) => {diff --git a/src/renderer/components/settings/sections/AgentsSection.tsx b/src/renderer/components/settings/sections/AgentsSection.tsxindex 6998cbc65..a8357520a 100644--- a/src/renderer/components/settings/sections/AgentsSection.tsx+++ b/src/renderer/components/settings/sections/AgentsSection.tsx@@ -31,7 +31,7 @@ import {unsupportedModesNote} from '@shared/agents/approval-mode'import { AgentIcon } from '../../../lib/agentIcons'-import { hintLabel } from '@shared/platform-utils'+import { chipFor } from '../../../lib/keybindingOverrides'import { NODE_IDENTITY_STRICT_DATE } from '@shared/node-identity'import { SegmentedPill } from '@renderer/ui/SegmentedPill'import { Button } from '@renderer/ui/Button'@@ -274,11 +274,16 @@ export function AgentsSection({ isActive }: { isActive: boolean }): React.JSX.El.join(' '): undefined+ // Whatever "new agent node" is bound to; '' when unbound, and the sentence drops the chord.+ const agentChip = chipFor('node.newAgent')+return (<SettingsSectionid="agents"title="Agents"- description={hintLabel('Enable or disable agents in the Add menus, and pick the default (⌘⇧C).')}+ description={agentChip+ ? `Enable or disable agents in the Add menus, and pick the default (${agentChip}).`+ : 'Enable or disable agents in the Add menus, and pick the default.'}isActive={isActive}searchEntries={ENTRIES}>diff --git a/src/renderer/lib/keybindingOverrides.test.ts b/src/renderer/lib/keybindingOverrides.test.tsindex abb125a66..c66fdee5a 100644--- a/src/renderer/lib/keybindingOverrides.test.ts+++ b/src/renderer/lib/keybindingOverrides.test.ts@@ -1,7 +1,9 @@import { describe, it, expect, vi, beforeEach } from 'vitest'import { DEFAULT_SETTINGS } from '@shared/types'import { useSettings } from '../state/settings'-import { activeKeybindingOverrides, effectiveBindings, commandKeys, commandTooltip } from './keybindingOverrides'+import {+ activeKeybindingOverrides, effectiveBindings, commandKeys, commandTooltip, chipFor+} from './keybindingOverrides'const setKb = (kb: unknown) =>useSettings.setState({ settings: { ...DEFAULT_SETTINGS, keybindings: kb as never } })@@ -51,3 +53,17 @@ describe('effectiveBindings / commandKeys / commandTooltip', () => {expect(commandKeys('canvas.fitAll', true)).toEqual([])})})++describe('chipFor', () => {+ it('renders the bare chord the way each platform spells it', () => {+ expect(chipFor('app.commandPalette', true)).toBe('⌘K')+ expect(chipFor('app.commandPalette', false)).toBe('Ctrl+K')+ })+ it('follows a remap', () => {+ setKb({ 'app.commandPalette': ['Cmd+Shift+P'] })+ expect(chipFor('app.commandPalette', true)).toBe('⌘⇧P')+ })+ it('is empty for an unbound command, so callers can fall back', () => {+ expect(chipFor('canvas.fitAll', true)).toBe('')+ })+})diff --git a/src/renderer/lib/keybindingOverrides.ts b/src/renderer/lib/keybindingOverrides.tsindex d5f49d128..8b3493e44 100644--- a/src/renderer/lib/keybindingOverrides.ts+++ b/src/renderer/lib/keybindingOverrides.ts@@ -45,3 +45,11 @@ export function commandTooltip(text: string, id: CommandId, isMac: boolean = isMif (!parts.length) return textreturn `${text} (${isMac ? parts.join('') : parts.join('+')})`}++/** The bare chord, as a chip: `'⌘K'` (mac) / `'Ctrl+K'`. **`''` when unbound** — every caller+ * embeds this in a sentence (`⌘M to exit`, `Message (⌘Enter to commit)`), so they must test it+ * and fall back to chord-less copy rather than rendering a stray fragment. */+export function chipFor(id: CommandId, isMac: boolean = isMacPlatform()): string {+ const parts = commandKeys(id, isMac)+ return isMac ? parts.join('') : parts.join('+')+}diff --git a/src/renderer/nodes/ChatPanel.tsx b/src/renderer/nodes/ChatPanel.tsxindex 9d86b9738..8f1232da7 100644--- a/src/renderer/nodes/ChatPanel.tsx+++ b/src/renderer/nodes/ChatPanel.tsx@@ -3,7 +3,7 @@ import { renderMarkdown } from '../lib/markdown'import { useAgentStatus } from '../state/agentStatus'import { useSession } from '../session/session'import type { ChatMessage } from '@shared/types'-import { hintLabel } from '@shared/platform-utils'+import { chipFor } from '../lib/keybindingOverrides'import { E_UNSUPPORTED } from '@shared/rpc'// Memoized bubble: marked+DOMPurify re-ran for EVERY message on each ChatPanel render (each@@ -121,11 +121,15 @@ export function ChatPanel({ nodeId, sessionId, cwd, accountId }: ChatPanelProps)}}+ // Whatever the markdown/chat toggle is bound to; '' when unbound, in which case the bar names+ // the action instead of promising a chord that never fires.+ const mdChip = chipFor('node.toggleMarkdown')+return (<div className="term-chat nodrag nowheel"><div className="term-chat__bar"><span>Chat</span>- <span className="term-chat__hint">{hintLabel('⌘M to exit')}</span>+ <span className="term-chat__hint">{mdChip ? `${mdChip} to exit` : 'Exit'}</span></div><div className="term-chat__msgs" ref={msgsRef}>{messages.length === 0 && loadState !== 'loading' && (diff --git a/src/renderer/nodes/EditorNode.tsx b/src/renderer/nodes/EditorNode.tsxindex 97cc94377..7ebce8d33 100644--- a/src/renderer/nodes/EditorNode.tsx+++ b/src/renderer/nodes/EditorNode.tsx@@ -12,6 +12,7 @@ import { useSession } from '../session/session'import type { CanvasNode } from '../state/workspace'import { tooLargeSize, formatBytes } from '@shared/fsLimits'import { hintLabel } from '@shared/platform-utils'+import { chipFor, commandTooltip } from '../lib/keybindingOverrides'import { pdfBlobUrl } from '../lib/pdfBlob'// Image extensions get a visual preview instead of the Monaco text editor.@@ -239,6 +240,10 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {if (hoveredRef.current) toggleRef.current()}), [])+ // Whatever the markdown toggle is bound to; '' when the user unbound it, in which case the+ // preview's hint names the action instead of promising a chord that never fires.+ const mdChip = chipFor('node.toggleMarkdown')+return (<divclassName={`term-node editor-node${selected ? ' selected' : ''}`}@@ -268,7 +273,7 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {<><buttonclassName="editor-node__toggle"- title={hintLabel('Toggle markdown preview (⌘M)')}+ title={commandTooltip('Toggle markdown preview', 'node.toggleMarkdown')}onClick={togglePreview}>{preview ? 'Edit' : 'Preview'}@@ -336,7 +341,7 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {<div className="term-md nodrag nowheel"><div className="term-md__bar"><span>Preview</span>- <span className="term-md__hint">{hintLabel('⌘M to edit')}</span>+ <span className="term-md__hint">{mdChip ? `${mdChip} to edit` : 'Edit'}</span></div><divclassName="term-md__content"diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex c1059e0c3..24189a3b8 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -166,7 +166,7 @@ import { agentEnvSnapshot } from '@renderer/lib/agentEnv'import { normalizedAgentModel } from '@shared/agents/model-gateway'import { ensureActivePermissionMode } from '../state/permissionMode'import { buildSshArgs, sshConnectionIdForProject, sshHostKey, type SshConnection } from '@shared/ssh'-import { hintLabel } from '@shared/platform-utils'+import { chipFor } from '../lib/keybindingOverrides'import { ColumnPill } from '../components/kanban/ColumnPill'import { BoardLogPanel } from '../components/kanban/BoardLogPanel'import { AgentMascot } from './AgentMascot'@@ -4150,6 +4150,10 @@ export function TerminalNode({status?.state !== 'waiting' &&status?.state !== 'blocked'+ // Whatever the markdown toggle is bound to; '' when the user unbound it, in which case the+ // markdown view's hint names the action instead of promising a chord that never fires.+ const mdChip = chipFor('node.toggleMarkdown')+return (<>{/* Sibling of the root: .term-node is overflow:hidden and would clip the half-pill. */}@@ -4632,7 +4636,7 @@ export function TerminalNode({<div className="term-md nodrag nowheel"><div className="term-md__bar"><span>Markdown</span>- <span className="term-md__hint">{hintLabel('⌘M to exit')}</span>+ <span className="term-md__hint">{mdChip ? `${mdChip} to exit` : 'Exit'}</span></div><div className="term-md__content" dangerouslySetInnerHTML={{ __html: mdHtml }} /></div>