Skip to content

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.

feat(linux): platform-aware shortcut labels (⌘ → Ctrl off-mac, incl. Server Edition)

enes77ff85bd9b65
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index a4f0f2f79..2cf623b49 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -131,6 +131,7 @@ 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 { useWorktrees } from '../state/worktrees'
import { activeSessionApi } from '../session/session'
import {
@@ -5657,7 +5658,7 @@ export function Canvas() {
onMouseEnter={openSessionsPeek}
onMouseLeave={closeSessionsPeekSoon}
>
- <button title="Sessions (⌘⇧L)" onClick={onSessionsIconClick}>
+ <button title={hintLabel('Sessions (⌘⇧L)')} onClick={onSessionsIconClick}>
<IconSessions />
</button>
</div>
@@ -5675,12 +5676,12 @@ export function Canvas() {
onClick={() => setPaletteOpen(true)}
>
<span className="cluster-search__icon">⌕</span>
- <span className="kbd">⌘K</span>
+ <span className="kbd">{hintLabel('⌘K')}</span>
</button>
- <button title="Explorer (⌘⇧E)" onClick={() => setExplorerOpen(true)}>
+ <button title={hintLabel('Explorer (⌘⇧E)')} onClick={() => setExplorerOpen(true)}>
<IconExplorer />
</button>
- <button title="Source Control (⌘⇧G)" onClick={() => setScOpen(true)}>
+ <button title={hintLabel('Source Control (⌘⇧G)')} onClick={() => setScOpen(true)}>
<IconBranch />
</button>
<button
@@ -5693,7 +5694,7 @@ export function Canvas() {
<IconPhone />
</button>
<button
- title="Settings (⌘,)"
+ title={hintLabel('Settings (⌘,)')}
onClick={() => {
setSettingsSection(undefined)
setSettingsOpen(true)
@@ -5710,7 +5711,7 @@ export function Canvas() {
x: Math.max(8, r.right - 220),
y: r.bottom + 6,
items: [
- { label: 'Keyboard shortcuts', hint: '⌘/', onClick: () => setShortcutsOpen(true) },
+ { label: 'Keyboard shortcuts', hint: hintLabel('⌘/'), onClick: () => setShortcutsOpen(true) },
{ label: 'Report a bug…', onClick: () => setBugReportOpen(true) },
{
label: 'Documentation',
@@ -5742,7 +5743,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">⌘K</span> command palette · <span className="kbd">+</span> in the dock below
+ <span className="kbd">{hintLabel('⌘K')}</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.tsx
index b005b801e..d1c63c7a4 100644
--- a/src/renderer/components/Dock.tsx
+++ b/src/renderer/components/Dock.tsx
@@ -1,5 +1,6 @@
import { useState } from 'react'
import { AGENT_CONFIG, BUILTIN_AGENT_IDS, type AgentId } from '@shared/agents/config'
+import { hintLabel } from '@shared/platform-utils'
import { AgentIcon } from '../lib/agentIcons'
import { useSettings } from '../state/settings'
import { useProjects } from '../state/projects'
@@ -165,10 +166,10 @@ export function Dock({
<span className="dock-sep" />
- <button className="dock-btn" title="Undo (⌘Z)" disabled={!canUndo} onClick={onUndo}>
+ <button className="dock-btn" title={hintLabel('Undo (⌘Z)')} disabled={!canUndo} onClick={onUndo}>
<UndoIcon />
</button>
- <button className="dock-btn" title="Redo (⌘⇧Z)" disabled={!canRedo} onClick={onRedo}>
+ <button className="dock-btn" title={hintLabel('Redo (⌘⇧Z)')} disabled={!canRedo} onClick={onRedo}>
<RedoIcon />
</button>
diff --git a/src/renderer/components/ShortcutsPanel.tsx b/src/renderer/components/ShortcutsPanel.tsx
index 2d4a20c17..d88ec6d3f 100644
--- a/src/renderer/components/ShortcutsPanel.tsx
+++ b/src/renderer/components/ShortcutsPanel.tsx
@@ -1,5 +1,6 @@
import { useEffect } from 'react'
import { createPortal } from 'react-dom'
+import { keyLabel } from '@shared/platform-utils'
interface ShortcutsPanelProps {
onClose: () => void
@@ -83,7 +84,7 @@ export function ShortcutsPanel({ onClose }: ShortcutsPanelProps) {
<span className="shortcut-keys">
{r.keys.map((k, i) => (
<kbd key={i} className="kbd">
- {k}
+ {keyLabel(k)}
</kbd>
))}
</span>
diff --git a/src/renderer/components/SourceControlPanel.tsx b/src/renderer/components/SourceControlPanel.tsx
index 51f217059..17cc3c34d 100644
--- a/src/renderer/components/SourceControlPanel.tsx
+++ b/src/renderer/components/SourceControlPanel.tsx
@@ -14,6 +14,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'
interface SourceControlPanelProps {
onClose: () => void
@@ -477,7 +478,7 @@ export function SourceControlPanel({
<div className="scm-compose">
<textarea
className="scm-message"
- placeholder="Message (⌘↵ to commit)"
+ placeholder={hintLabel('Message (⌘↵ to commit)')}
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.tsx
index 06e725f81..2534a39b2 100644
--- a/src/renderer/components/settings/sections/AgentsSection.tsx
+++ b/src/renderer/components/settings/sections/AgentsSection.tsx
@@ -17,6 +17,7 @@ import {
type AgentPermissionMode
} from '@shared/agents/config'
import { AgentIcon } from '../../../lib/agentIcons'
+import { hintLabel } from '@shared/platform-utils'
import { SegmentedPill } from '@renderer/ui/SegmentedPill'
import { Button } from '@renderer/ui/Button'
import { Select } from '@renderer/ui/Select'
@@ -81,7 +82,7 @@ export function AgentsSection({ isActive }: { isActive: boolean }): React.JSX.El
<SettingsSection
id="agents"
title="Agents"
- description="Enable or disable agents in the Add menus, and pick the default (⌘⇧C)."
+ description={hintLabel('Enable or disable agents in the Add menus, and pick the default (⌘⇧C).')}
isActive={isActive}
searchEntries={ENTRIES}
>
diff --git a/src/renderer/components/settings/sections/BehaviorSection.tsx b/src/renderer/components/settings/sections/BehaviorSection.tsx
index f10cc0cff..2db5a0fce 100644
--- a/src/renderer/components/settings/sections/BehaviorSection.tsx
+++ b/src/renderer/components/settings/sections/BehaviorSection.tsx
@@ -4,6 +4,7 @@ import { SearchableRow } from '../SearchableRow'
import { FieldRow } from '../FieldRow'
import { Switch } from '@renderer/ui/Switch'
import { NumberField } from '@renderer/ui/NumberField'
+import { hintLabel } from '@shared/platform-utils'
const ROWS = {
gridSize: { title: 'Grid size', keywords: ['grid', 'size', 'snap'] },
@@ -119,7 +120,7 @@ export function BehaviorSection({ isActive }: { isActive: boolean }): React.JSX.
<SearchableRow {...ROWS.wheelZoom}>
<FieldRow
label="Scroll wheel zooms"
- description="Zoom with a plain mouse wheel (no ⌘). Turns off scroll-to-pan — pan by dragging."
+ description={hintLabel('Zoom with a plain mouse wheel (no ⌘). Turns off scroll-to-pan — pan by dragging.')}
control={
<Switch
checked={settings.wheelZoom}
diff --git a/src/renderer/nodes/ChatPanel.tsx b/src/renderer/nodes/ChatPanel.tsx
index b7a83a512..c5b44a1ed 100644
--- a/src/renderer/nodes/ChatPanel.tsx
+++ b/src/renderer/nodes/ChatPanel.tsx
@@ -3,6 +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'
// Memoized bubble: marked+DOMPurify re-ran for EVERY message on each ChatPanel render (each
// turn-finish reload, each keystroke re-render). Text is stable per message, so cache per text.
@@ -83,7 +84,7 @@ export function ChatPanel({ nodeId, sessionId, cwd, accountId }: ChatPanelProps)
<div className="term-chat nodrag nowheel">
<div className="term-chat__bar">
<span>Chat</span>
- <span className="term-chat__hint">⌘M to exit</span>
+ <span className="term-chat__hint">{hintLabel('⌘M to exit')}</span>
</div>
<div className="term-chat__msgs" ref={msgsRef}>
{messages.length === 0 && <div className="term-chat__empty">No conversation yet.</div>}
diff --git a/src/renderer/nodes/EditorNode.tsx b/src/renderer/nodes/EditorNode.tsx
index 88f93f7c3..922e3a9ed 100644
--- a/src/renderer/nodes/EditorNode.tsx
+++ b/src/renderer/nodes/EditorNode.tsx
@@ -8,6 +8,7 @@ import { useProjects } from '../state/projects'
import { useSession } from '../session/session'
import type { CanvasNode } from '../state/workspace'
import { tooLargeSize, formatBytes } from '@shared/fsLimits'
+import { hintLabel } from '@shared/platform-utils'
// Image extensions get a visual preview instead of the Monaco text editor.
const IMAGE_MIME: Record<string, string> = {
@@ -206,7 +207,7 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {
<>
<button
className="editor-node__toggle"
- title="Toggle markdown preview (⌘M)"
+ title={hintLabel('Toggle markdown preview (⌘M)')}
onClick={togglePreview}
>
{preview ? 'Edit' : 'Preview'}
@@ -214,7 +215,7 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {
<button
className="editor-node__save"
disabled={!dirty}
- title="Save (⌘S)"
+ title={hintLabel('Save (⌘S)')}
onClick={save}
>
Save
@@ -263,7 +264,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">⌘M to edit</span>
+ <span className="term-md__hint">{hintLabel('⌘M to edit')}</span>
</div>
<div
className="term-md__content"
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index 5831b0ca7..6883ad306 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -71,6 +71,7 @@ import { accountChipLabel, COLLAPSED_HEIGHT, NODE_COLORS, type CanvasNode } from
import { hasHooks, canRecur, canContextLink, hasUsage, canChat, canResume, canRename, resumeCommand, withPermissionMode, agentConfig, type AgentId } from '@shared/agents/config'
import { ensureActivePermissionMode } from '../state/permissionMode'
import { buildSshArgs, type SshConnection } from '@shared/ssh'
+import { hintLabel } from '@shared/platform-utils'
/** Backslash-escape shell-special characters, like a native terminal does on file drop. */
function escapeDroppedPath(p: string): string {
@@ -1706,7 +1707,7 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasN
</button>
</Tooltip>
{showChat && (
- <Tooltip label="Chat / markdown view (⌘M)">
+ <Tooltip label={hintLabel('Chat / markdown view (⌘M)')}>
<button
className="term-node__chat nodrag"
aria-pressed={!!data.mdMode}
@@ -1791,7 +1792,7 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasN
<div className="term-md nodrag nowheel">
<div className="term-md__bar">
<span>Markdown</span>
- <span className="term-md__hint">⌘M to exit</span>
+ <span className="term-md__hint">{hintLabel('⌘M to exit')}</span>
</div>
<div className="term-md__content" dangerouslySetInnerHTML={{ __html: mdHtml }} />
</div>
diff --git a/src/shared/platform-utils.test.ts b/src/shared/platform-utils.test.ts
new file mode 100644
index 000000000..44bbff7da
--- /dev/null
+++ b/src/shared/platform-utils.test.ts
@@ -0,0 +1,41 @@
+import { describe, it, expect } from 'vitest'
+import { hintLabel, keyLabel, modSymbol } from './platform-utils'
+
+describe('hintLabel', () => {
+ it('passes mac strings through untouched', () => {
+ expect(hintLabel('Save (⌘S)', true)).toBe('Save (⌘S)')
+ expect(hintLabel('Redo (⌘⇧Z)', true)).toBe('Redo (⌘⇧Z)')
+ })
+ it('rewrites plain chords on non-mac', () => {
+ expect(hintLabel('Save (⌘S)', false)).toBe('Save (Ctrl+S)')
+ expect(hintLabel('⌘K', false)).toBe('Ctrl+K')
+ expect(hintLabel('Settings (⌘,)', false)).toBe('Settings (Ctrl+,)')
+ expect(hintLabel('⌘/', false)).toBe('Ctrl+/')
+ })
+ it('rewrites shift chords on non-mac', () => {
+ expect(hintLabel('Redo (⌘⇧Z)', false)).toBe('Redo (Ctrl+Shift+Z)')
+ expect(hintLabel('Explorer (⌘⇧E)', false)).toBe('Explorer (Ctrl+Shift+E)')
+ })
+ it('keeps the return symbol and rewrites the modifier', () => {
+ expect(hintLabel('Message (⌘↵ to commit)', false)).toBe('Message (Ctrl+↵ to commit)')
+ })
+ it('handles a bare ⌘ with no trailing key', () => {
+ expect(hintLabel('no ⌘', false)).toBe('no Ctrl')
+ expect(hintLabel('Zoom with a plain mouse wheel (no ⌘).', false)).toBe(
+ 'Zoom with a plain mouse wheel (no Ctrl).'
+ )
+ })
+})
+
+describe('keyLabel / modSymbol', () => {
+ it('maps single key tokens', () => {
+ expect(keyLabel('⌘', false)).toBe('Ctrl')
+ expect(keyLabel('⇧', false)).toBe('Shift')
+ expect(keyLabel('K', false)).toBe('K')
+ expect(keyLabel('⌘', true)).toBe('⌘')
+ })
+ it('modSymbol matches keyLabel for ⌘', () => {
+ expect(modSymbol(false)).toBe('Ctrl')
+ expect(modSymbol(true)).toBe('⌘')
+ })
+})
diff --git a/src/shared/platform-utils.ts b/src/shared/platform-utils.ts
new file mode 100644
index 000000000..b0e3662ca
--- /dev/null
+++ b/src/shared/platform-utils.ts
@@ -0,0 +1,38 @@
+/**
+ * Platform detection + display helpers for keyboard-shortcut labels.
+ *
+ * Display only: key HANDLERS across the renderer already accept `metaKey || ctrlKey`
+ * (Server Edition heritage) — these helpers fix what the user *sees*. Navigator-based
+ * (not process.platform) so the answer is correct in the Electron renderer AND in a
+ * Server Edition browser tab on any OS. Canonical shortcut strings stay mac-notation
+ * (`⌘⇧Z`) at their definition sites; the rewrite happens at render time.
+ */
+
+/** True on macOS (Electron renderer or browser). Safe outside a DOM (falls back to mac notation). */
+export function isMacPlatform(): boolean {
+ if (typeof navigator === 'undefined') return true
+ return /Mac/i.test(navigator.platform || navigator.userAgent)
+}
+
+/** Rewrite mac chord notation in a hint string for the current platform. */
+export function hintLabel(text: string, isMac: boolean = isMacPlatform()): string {
+ if (isMac) return text
+ return text
+ .replace(/⌘⇧/g, 'Ctrl+Shift+')
+ .replace(/⌘(?=[A-Za-z0-9,/↵])/g, 'Ctrl+')
+ .replace(/⌘/g, 'Ctrl')
+ .replace(/⇧/g, 'Shift+')
+}
+
+/** Map a single key token (as used by ShortcutsPanel's keys arrays). */
+export function keyLabel(key: string, isMac: boolean = isMacPlatform()): string {
+ if (isMac) return key
+ if (key === '⌘') return 'Ctrl'
+ if (key === '⇧') return 'Shift'
+ return key
+}
+
+/** The platform's primary modifier symbol. */
+export function modSymbol(isMac: boolean = isMacPlatform()): string {
+ return keyLabel('⌘', isMac)
+}