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(settings): open native settings menu
Darren Kattan5f636dc88ac0
diff --git a/src/main/index.ts b/src/main/index.tsindex 0b5cebd2e..c7df5c303 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -5,7 +5,7 @@ import { readFile } from 'fs/promises'import { existsSync, statSync } from 'fs'import { homedir, hostname } from 'os'import { randomUUID } from 'crypto'-import { app, BrowserWindow, clipboard, dialog, ipcMain, Notification, powerMonitor, safeStorage, shell, systemPreferences, webContents } from 'electron'+import { app, BrowserWindow, clipboard, dialog, ipcMain, Menu, Notification, powerMonitor, safeStorage, shell, systemPreferences, webContents } from 'electron'import { IPC } from '../shared/ipc'import { writeFilesToClipboard } from './clipboard-files'import { registerFsHandlers } from '../core/fs-handlers'@@ -379,6 +379,112 @@ if (process.platform !== 'win32' && typeof process.setFdLimit === 'function') {}}+/**+ * The native application menu. macOS-idiomatic: the app-name menu (About/Quit) first, then an+ * Edit menu with the standard text-editing roles (Undo/Redo/Cut/Copy/Paste/Select All — these+ * make keyboard shortcuts work in inputs and the webview), then a Window menu, with a+ * "Settings…" item (⌘,) in the app menu that opens the settings page.+ *+ * Until now the app shipped with Electron's DEFAULT menu (which has no Settings item, and whose+ * Edit roles only covered the main webContents). The only way to reach Settings was the in-canvas+ * gear button. This adds the menu entry Mac users look for reflexively (⌘, → app menu → Settings).+ *+ * The Settings item sends `IPC.appOpenSettings` to the renderer, which opens the same settings page+ * the gear button and the Cmd+, keydown do — one IPC, the renderer owns the open/close state.+ * `before-input-event` already routes a typed ⌘, to the renderer, so this menu item is what makes+ * the MENU route (clicking the item, or focusing the menu bar and pressing ⌘,) reach the same+ * place: a menu click does NOT fire before-input-event, so without this the menu would be inert.+ */+function buildAppMenu(): void {+ const isMac = process.platform === 'darwin'+ const settingsItem = {+ label: isMac ? 'Settings…' : 'Settings',+ accelerator: 'CmdOrCtrl+,',+ click: () => {+ const win = getMainWindow()+ if (win && !win.isDestroyed()) win.webContents.send(IPC.appOpenSettings)+ }+ }+ const template: Electron.MenuItemConstructorOptions[] = isMac+ ? [+ {+ label: app.name,+ submenu: [+ { role: 'about' },+ { type: 'separator' },+ settingsItem,+ { type: 'separator' },+ { role: 'services' },+ { type: 'separator' },+ { role: 'hide' },+ { role: 'hideOthers' },+ { role: 'unhide' },+ { type: 'separator' },+ { role: 'quit' }+ ]+ },+ {+ label: 'Edit',+ submenu: [+ { role: 'undo' },+ { role: 'redo' },+ { type: 'separator' },+ { role: 'cut' },+ { role: 'copy' },+ { role: 'paste' },+ { role: 'pasteAndMatchStyle' },+ { role: 'delete' },+ { role: 'selectAll' }+ ]+ },+ {+ label: 'View',+ submenu: [{ role: 'toggleDevTools' }]+ },+ {+ label: 'Window',+ submenu: [+ { role: 'minimize' },+ { role: 'zoom' },+ { type: 'separator' },+ { role: 'front' }+ ]+ }+ ]+ : [+ {+ label: 'File',+ submenu: [{ role: 'quit' }]+ },+ {+ label: 'Edit',+ submenu: [+ { role: 'undo' },+ { role: 'redo' },+ { type: 'separator' },+ { role: 'cut' },+ { role: 'copy' },+ { role: 'paste' },+ { role: 'delete' },+ { role: 'selectAll' }+ ]+ },+ {+ label: 'View',+ submenu: [{ role: 'toggleDevTools' }]+ },+ {+ label: 'Settings',+ submenu: [settingsItem]+ },+ {+ label: 'Window',+ submenu: [{ role: 'minimize' }, { role: 'close' }]+ }+ ]+ Menu.setApplicationMenu(Menu.buildFromTemplate(template))+}+function createWindow(): BrowserWindow {// On Linux the window/taskbar icon is not supplied by an app bundle (unlike macOS),// so set it explicitly from the bundled png (extraResources). mac/win are untouched —@@ -1020,6 +1126,7 @@ app.whenReady().then(async () => {console.error('[ssh-askpass] script generation failed, relay disabled:', e)return undefined})+ buildAppMenu()const win = createWindow()// NT_MULTI instances are throwaway dev sandboxes. The dock badge is the one marker that is// always visible on macOS (the window title is hidden by titleBarStyle: 'hiddenInset', and thediff --git a/src/preload/index.ts b/src/preload/index.tsindex 78da71807..d87976a3b 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -566,6 +566,7 @@ const api: NodeTerminalApi = {onMarkdownToggle: subscribe(IPC.appToggleMarkdown),onCloseNode: subscribe(IPC.appCloseNode),onZoomActualSize: subscribe(IPC.appZoomActualSize),+ onOpenSettings: subscribe(IPC.appOpenSettings),closeWindow: () => ipcRenderer.send(IPC.appCloseWindow),focusWindow: () => ipcRenderer.send(IPC.appFocusWindow),setBadgeCount: (count) => ipcRenderer.send(IPC.appSetBadge, count),diff --git a/src/renderer/bridge/stubs.ts b/src/renderer/bridge/stubs.tsindex d60db9609..84f2f6f42 100644--- a/src/renderer/bridge/stubs.ts+++ b/src/renderer/bridge/stubs.ts@@ -343,6 +343,7 @@ export function buildStubApi(): Omit<// Deliberate no-op (not a gap): a browser tab has no application menu to steal ⌘0, so the// renderer's own keydown handler is the whole path there.onZoomActualSize: noopUnsub,+ onOpenSettings: noopUnsub,closeWindow: noop,// Best-effort: a browser tab can't force itself frontmost the way the desktop BrowserWindow// can, but `window.focus()` still helps when the page is merely blurred (not another OS app).diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 14a844e49..af62dcb21 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -3979,6 +3979,16 @@ export function Canvas() {})}, [deleteNodes])+ // The native app menu's "Settings…" item (⌘,) → open settings, same as the gear button and the+ // Cmd+, keydown. Main sends IPC.appOpenSettings when the menu item is clicked (a menu click does+ // not fire before-input-event, so the typed-⌘, path alone would leave the menu item inert).+ useEffect(() => {+ return window.nodeTerminal.onOpenSettings(() => {+ setSettingsSection(undefined)+ setSettingsOpen(true)+ })+ }, [])+const groupSelection = useCallback((ids: string[]) => {const groupCount = nodesRef.current.filter((n) => n.type === 'group').lengthdiff --git a/src/shared/ipc.ts b/src/shared/ipc.tsindex f79c41306..02e5d6ccf 100644--- a/src/shared/ipc.ts+++ b/src/shared/ipc.ts@@ -61,6 +61,9 @@ export const IPC = {* page zoom rather than the canvas's. */appZoomActualSize: 'app:zoom-actual-size',appCloseWindow: 'app:close-window',+ /** Main → renderer: the native application menu's "Settings…" item (⌘,) was clicked. The+ * renderer opens the settings page — same path as the in-canvas gear button / Cmd+, keydown. */+ appOpenSettings: 'app:open-settings',appFocusWindow: 'app:focus-window',/** Write text to the system clipboard from the MAIN process. Renderer-side `clipboard` access is* deprecated in Electron; the renderer sends this instead (fire-and-forget). */diff --git a/src/shared/types.ts b/src/shared/types.tsindex 1899e83da..eefd4bfb2 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -2311,6 +2311,8 @@ export interface NodeTerminalApi {* key is intercepted in main because Electron's default View menu owns the accelerator. In the* Server Edition the renderer's own keydown handler sees the key and this is a no-op stub. */onZoomActualSize(listener: () => void): () => void+ /** Fires when the native app menu's "Settings…" item (⌘,) is clicked. Returns unsubscribe. */+ onOpenSettings(listener: () => void): () => void/** Close the application window (Cmd/Ctrl+W fallback when no node is selected). */closeWindow(): void/** Bring the app window to the foreground (show + OS focus). Called after a file is DROPPED