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
fix(notch-hud): keep the app in the Dock; match agent-notch's look
enes7243b0a95c22
diff --git a/src/main/index.ts b/src/main/index.tsindex dadf71106..5c1b905e6 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -31,7 +31,8 @@ import {setNotchHudEnabled,destroyNotchHud,notchHudOnAgentEvent,- notchHudOnContextUpdate+ notchHudOnContextUpdate,+ assertRegularDockPresence} from './notch-hud'import {initAgentStatusMirror,@@ -362,6 +363,9 @@ function createWindow(): BrowserWindow {win.webContents.on('render-process-gone', () => ptyManager.dropClient(presenceId))win.on('ready-to-show', () => win.show())+ // The main window is a regular app window; establishing its Dock presence explicitly means the+ // later focusable:false Notch HUD panel can never leave the app looking like an accessory.+ win.on('show', () => assertRegularDockPresence())// macOS: closing the window hides it instead of destroying it. The app deliberately// outlives its window (tmux sessions, hook server, updater); destroying the window@@ -738,7 +742,16 @@ app.whenReady().then(async () => {initAgentStatusMirror()// macOS Notch HUD (docs/notch-hud.md): walking agent mascots by the notch. darwin + setting only;// reads the same agent-status seams the mirror does. Live-toggled via settings below.- initNotchHud({ getNodeTitle: (nodeId) => workspaceStore.getNodeTitle(nodeId) }, settingsStore.get().notchHud)+ //+ // Create the HUD only AFTER the main window is visible. The HUD is a focusable:false (non-+ // activating) panel; if it is shown while the main window is still loading (created with+ // show:false, shown on 'ready-to-show'), it can be the only orderFront-ed window on screen and+ // demote the app to accessory — the Dock icon then disappears. Gating on the main window's first+ // 'show' guarantees a regular window has established the app's Dock presence first.+ const startNotchHud = (): void =>+ initNotchHud({ getNodeTitle: (nodeId) => workspaceStore.getNodeTitle(nodeId) }, settingsStore.get().notchHud)+ if (win.isVisible()) startNotchHud()+ else win.once('show', startNotchHud)settingsStore.onChange((s) => setNotchHudEnabled(s.notchHud))// Advertise launch settings to the mobile companion through the mirror. The provider is// consulted at every flush (heartbeat ≤60s), so a settings change propagates without extradiff --git a/src/main/notch-hud.ts b/src/main/notch-hud.tsindex a07bb5f4e..d7b9fa329 100644--- a/src/main/notch-hud.ts+++ b/src/main/notch-hud.ts@@ -8,7 +8,7 @@// extra streams in (the normalized agent-event stream for prompt+subagents, and context-update for// the model) via the module-level notchHudOn* functions, which no-op when the HUD is off.-import { BrowserWindow, ipcMain, screen } from 'electron'+import { app, BrowserWindow, ipcMain, screen } from 'electron'import { join } from 'path'import { IPC } from '../shared/ipc'import { getMainWindow, sendToMain } from './main-window'@@ -33,6 +33,32 @@ const PUSH_DEBOUNCE_MS = 150/** Low-frequency sweep so stale (gone + idle > 6h) nodes drop even with no live events. */const SWEEP_MS = 10 * 60 * 1000+/**+ * Keep the app a REGULAR Dock app even though the HUD is a `focusable:false` (non-activating+ * panel) overlay. On macOS `focusable:false` maps to AppKit's `setDisableKeyOrMainWindow:YES`, so+ * the HUD window can never become the app's key/main window. If such a panel is the only window+ * that is orderFront-ed on screen (e.g. it shows before the main window has finished loading, or+ * while the main window is hidden by hide-on-close), macOS re-evaluates the app as having no+ * regular window and drops its Dock tile — the "Dock icon disappears once the HUD opens" bug.+ * Asserting `regular` + `dock.show()` is idempotent and cheap, and guarantees the HUD never+ * demotes the app's Dock presence. No-op off macOS.+ */+export function assertRegularDockPresence(): void {+ if (process.platform !== 'darwin') return+ try {+ // Idempotent: re-asserting 'regular' when already regular is a no-op.+ app.setActivationPolicy('regular')+ } catch {+ /* older Electron / transient — ignore */+ }+ // `dock.show()` returns a Promise in recent Electron; swallow it either way.+ try {+ void Promise.resolve(app.dock?.show()).catch(() => {})+ } catch {+ /* ignore */+ }+}+// ---- Singleton (mirror main-window.ts) -----------------------------------------------------let hudWin: BrowserWindow | null = null@@ -225,6 +251,9 @@ class NotchHudController {win.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true })// Passive by default: the strip is click-through; the renderer flips this OFF over the hotspot.win.setIgnoreMouseEvents(true, { forward: true })+ // The HUD must NEVER affect the Dock: this is a regular Dock app. Creating a focusable:false+ // panel can otherwise demote the app to accessory and drop the Dock icon — re-assert here.+ assertRegularDockPresence()win.on('closed', () => {if (hudWin === win) hudWin = null@@ -238,6 +267,9 @@ class NotchHudController {}win.webContents.on('did-finish-load', () => {win.showInactive() // show without stealing focus+ // Showing the panel is exactly when macOS re-evaluates the app's window set — re-assert the+ // regular Dock policy so the freshly-shown non-activating panel can't demote us to accessory.+ assertRegularDockPresence()this.pushNow()})}diff --git a/src/renderer/hud/hud.css b/src/renderer/hud/hud.cssindex 7ea0948dc..440820a59 100644--- a/src/renderer/hud/hud.css+++ b/src/renderer/hud/hud.css@@ -1,5 +1,11 @@/* Notch HUD (docs/notch-hud.md) — transparent overlay; only the indicator + panel paint. */+:root {+ /* agent-notch's panel is monospaced throughout (NSFont.monospacedSystemFont). Match it. */+ --hud-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, 'Cascadia Mono', 'Roboto Mono',+ monospace;+}+* {box-sizing: border-box;}@@ -118,14 +124,23 @@ body {}}-/* Green "done, unseen" blob. */+/* Green "done, unseen" blob — a 7×7 crisp green pixel circle (agent-notch look), built as a sprite+ in lib/mascot.ts and shown as a pixelated background; CSS drives the shimmer. */.done-blob {- width: 10px;- height: 10px;+ width: 12px;+ height: 12px;+ background-repeat: no-repeat;+ background-position: center;+ background-size: contain;+ image-rendering: pixelated;+ flex-shrink: 0;+ animation: hud-shimmer 1.4s ease-in-out infinite;+}+/* Fallback when the pixel sprite couldn't be built (no DOM canvas): a plain round green blob. */+.done-blob--fallback {border-radius: 50%;background: #30d158;box-shadow: 0 0 6px 1px rgba(48, 209, 88, 0.7);- animation: hud-shimmer 1.4s ease-in-out infinite;}@keyframes hud-shimmer {0%,@@ -140,16 +155,18 @@ body {/* --- Expanded panel --- */.hud-panel {margin-top: 2px;- width: 380px;+ width: 400px;max-height: 420px;overflow-y: auto;- padding: 6px;+ padding: 8px 10px;border-radius: 14px;- background: rgba(28, 28, 30, 0.92);- border: 1px solid rgba(255, 255, 255, 0.1);- box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);- backdrop-filter: blur(22px) saturate(1.4);- -webkit-backdrop-filter: blur(22px) saturate(1.4);+ /* agent-notch's panel is opaque black attached under the notch — go near-black. */+ background: rgba(12, 12, 13, 0.97);+ border: 1px solid rgba(255, 255, 255, 0.08);+ box-shadow: 0 12px 44px rgba(0, 0, 0, 0.6);+ backdrop-filter: blur(18px) saturate(1.3);+ -webkit-backdrop-filter: blur(18px) saturate(1.3);+ font-family: var(--hud-mono);color: #f2f2f7;/* Collapsed by default: scaled to nothing from the top center. */transform-origin: top center;@@ -187,8 +204,10 @@ body {width: 22px;}.hud-row__title {- font-size: 13px;- font-weight: 590;+ font-family: var(--hud-mono);+ font-size: 12px;+ font-weight: 600;+ letter-spacing: -0.2px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;@@ -196,10 +215,11 @@ body {.hud-row__tag {grid-column: 3;grid-row: 1;- font-size: 11px;+ font-family: var(--hud-mono);+ font-size: 10px;font-variant-numeric: tabular-nums;white-space: nowrap;- opacity: 0.85;+ opacity: 0.9;}.hud-row__tag--working {color: #0a84ff;@@ -216,17 +236,32 @@ body {.hud-row__sub {grid-column: 2 / span 2;grid-row: 2;- font-size: 11.5px;- color: #aeaeb2;+ font-family: var(--hud-mono);+ font-size: 11px;+ color: #98989d;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}.hud-row__sub b {- color: #d1d1d6;+ color: #c7c7cc;font-weight: 600;}+/* Dithered pixel separator between rows (agent-notch's DitherSeparator: a sparse row of gray+ pixels). Two offset dashed gradients read as scattered 2px cells rather than a solid rule. */+.hud-sep {+ height: 3px;+ margin: 3px 4px;+ opacity: 0.6;+ background-image:+ repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 2px, transparent 2px 6px),+ repeating-linear-gradient(90deg, transparent 0 4px, rgba(255, 255, 255, 0.08) 4px 6px);+ background-position:+ 0 0,+ 3px 0;+}+/* Subagent disclosure */.hud-subs {grid-column: 2 / span 2;@@ -234,8 +269,11 @@ body {margin-top: 4px;}.hud-subs__toggle {- font-size: 11px;- color: #8e8e93;+ font-family: var(--hud-mono);+ font-size: 10px;+ font-weight: 600;+ color: #0a84ff;+ padding-left: 20px;cursor: pointer;}.hud-subs__list {@@ -247,9 +285,10 @@ body {display: flex;align-items: center;gap: 6px;- font-size: 11px;+ font-family: var(--hud-mono);+ font-size: 10.5px;color: #c7c7cc;- padding: 1px 0;+ padding: 1px 0 1px 20px;}.hud-subs__dot {width: 6px;@@ -268,7 +307,8 @@ body {grid-column: 3;grid-row: 2;justify-self: end;- font-size: 11px;+ font-family: var(--hud-mono);+ font-size: 10px;font-weight: 600;color: #0a84ff;background: rgba(10, 132, 255, 0.15);diff --git a/src/renderer/hud/indicator.test.ts b/src/renderer/hud/indicator.test.tsnew file mode 100644index 000000000..b063d6827--- /dev/null+++ b/src/renderer/hud/indicator.test.ts@@ -0,0 +1,29 @@+import { describe, it, expect } from 'vitest'+import { orderIndicatorAgents } from './indicator'++describe('orderIndicatorAgents', () => {+ it('puts Claude rightmost (last) and Codex to its left, matching agent-notch', () => {+ // Rightmost = last child (notch-side). agent-notch draws claude nearest the notch, codex left.+ expect(orderIndicatorAgents(['claude', 'codex'])).toEqual(['codex', 'claude'])+ expect(orderIndicatorAgents(['codex', 'claude'])).toEqual(['codex', 'claude'])+ })++ it('orders gemini left of codex left of claude', () => {+ expect(orderIndicatorAgents(['claude', 'gemini', 'codex'])).toEqual(['gemini', 'codex', 'claude'])+ })++ it('keeps unknown/custom agents furthest left, in stable input order', () => {+ expect(orderIndicatorAgents(['claude', 'my-agent', 'other'])).toEqual(['my-agent', 'other', 'claude'])+ })++ it('handles a single agent and empty input', () => {+ expect(orderIndicatorAgents(['claude'])).toEqual(['claude'])+ expect(orderIndicatorAgents([])).toEqual([])+ })++ it('does not mutate the input array', () => {+ const input = ['claude', 'codex']+ orderIndicatorAgents(input)+ expect(input).toEqual(['claude', 'codex'])+ })+})diff --git a/src/renderer/hud/indicator.ts b/src/renderer/hud/indicator.tsnew file mode 100644index 000000000..d218d4ec4--- /dev/null+++ b/src/renderer/hud/indicator.ts@@ -0,0 +1,29 @@+// Pure ordering for the collapsed Notch HUD indicator (docs/notch-hud.md).+//+// The indicator hugs the LEFT edge of the notch and reads right→left. agent-notch draws Claude+// rightmost (nearest the notch) and Codex to its left (main.swift IndicatorView.draw: claude is+// drawn first at bounds.maxX, then codex to the left). Our indicator is a normal left→right flex+// row, so the LAST element is the rightmost/notch-side one. This helper returns the working agent+// ids in left→right paint order (Claude last) so the DOM matches agent-notch's slot order.+//+// Kept pure + Electron-free so it is unit-tested without a DOM.++/** Higher rank = drawn further RIGHT (closer to the notch). Claude is the notch-side anchor. */+const SLOT_RANK: Record<string, number> = {+ claude: 3,+ codex: 2,+ gemini: 1+}++/**+ * Order the distinct working agent ids left→right so the notch-side slot (rightmost, last child)+ * is Claude, then Codex to its left, with any other/custom agents further left. Ties (unknown+ * agents, rank 0) keep their incoming order (a stable sort), so the collapsed strip stays stable+ * frame-to-frame instead of reshuffling as rows re-sort by activity.+ */+export function orderIndicatorAgents(workingAgents: readonly string[]): string[] {+ return workingAgents+ .map((id, i) => ({ id, i, rank: SLOT_RANK[id] ?? 0 }))+ .sort((a, b) => a.rank - b.rank || a.i - b.i)+ .map((e) => e.id)+}diff --git a/src/renderer/hud/main.ts b/src/renderer/hud/main.tsindex c08962701..62445a196 100644--- a/src/renderer/hud/main.ts+++ b/src/renderer/hud/main.ts@@ -4,7 +4,8 @@// and row clicks to focus the node in nodeterm.import './hud.css'-import { CLAUDE_MASCOT, CODEX_MASCOT } from '../lib/mascot'+import { CLAUDE_MASCOT, CODEX_MASCOT, DONE_BLOB } from '../lib/mascot'+import { orderIndicatorAgents } from './indicator'import codexPet from '../assets/pet-codex.webp'// Local mirror of the preload's HUD contract (src/preload/hud.ts) — kept self-contained so this@@ -96,21 +97,32 @@ function reltime(ts: number): string {// ---- Mascot / icon builders ----------------------------------------------------------------+// Indicator mascot heights in the menu-bar strip (px). agent-notch draws Claude ~ the bar height+// and the Codex pet at 26px; these are the sensible defaults — NAIL EXACTLY ON A MAC (the notch+// bar height varies by model, and 26px overflows a short bar). Aspect ratios are preserved from+// the sprite geometry, so only the height matters.+const HUD_CLAUDE_H = 18+const HUD_CODEX_H = 24+function claudeMascot(): HTMLElement {const el = document.createElement('span')el.className = 'mascot mascot--claude'- el.style.setProperty('--mascot-w', `${CLAUDE_MASCOT.frameWidth}px`)- el.style.setProperty('--mascot-h', `${CLAUDE_MASCOT.frameHeight}px`)+ const h = HUD_CLAUDE_H+ const w = Math.round((h * CLAUDE_MASCOT.frameWidth) / CLAUDE_MASCOT.frameHeight)+ el.style.setProperty('--mascot-w', `${w}px`)+ el.style.setProperty('--mascot-h', `${h}px`)el.style.backgroundImage = `url(${CLAUDE_MASCOT.src})`return el}function codexMascot(): HTMLElement {const el = document.createElement('span')el.className = 'mascot mascot--codex'- el.style.setProperty('--cmascot-w', `${CODEX_MASCOT.frameWidth}px`)- el.style.setProperty('--cmascot-h', `${CODEX_MASCOT.frameHeight}px`)- el.style.setProperty('--cmascot-sheet-w', `${CODEX_MASCOT.frameWidth * CODEX_MASCOT.cols}px`)- el.style.setProperty('--cmascot-sheet-h', `${CODEX_MASCOT.frameHeight * CODEX_MASCOT.rows}px`)+ const h = HUD_CODEX_H+ const w = Math.round((h * CODEX_MASCOT.frameWidth) / CODEX_MASCOT.frameHeight)+ el.style.setProperty('--cmascot-w', `${w}px`)+ el.style.setProperty('--cmascot-h', `${h}px`)+ el.style.setProperty('--cmascot-sheet-w', `${w * CODEX_MASCOT.cols}px`)+ el.style.setProperty('--cmascot-sheet-h', `${h * CODEX_MASCOT.rows}px`)el.style.backgroundImage = `url(${codexPet})`return el}@@ -121,6 +133,15 @@ function workingMascot(agentId?: string): HTMLElement {dot.className = 'mascot mascot--dot'return dot}+function doneBlob(): HTMLElement {+ const blob = document.createElement('span')+ blob.className = 'done-blob'+ // 7×7 crisp green pixel circle (agent-notch look); CSS drives the shimmer. Falls back to the+ // CSS-only round blob when the sprite couldn't be built (no DOM canvas).+ if (DONE_BLOB.src) blob.style.backgroundImage = `url(${DONE_BLOB.src})`+ else blob.classList.add('done-blob--fallback')+ return blob+}function rowIcon(row: HudRow): HTMLElement {if (row.state === 'working') return workingMascot(row.agentId)if (row.state === 'done') {@@ -149,12 +170,10 @@ function renderIndicator(rows: HudRow[]): void {doneUnseen = true}}- for (const agentId of workingAgents) indicator.append(workingMascot(agentId))- if (doneUnseen) {- const blob = document.createElement('span')- blob.className = 'done-blob'- indicator.append(blob)- }+ // Left→right paint order: a "done" blob sits furthest from the notch, then the working mascots+ // with Claude nearest the notch (rightmost) — agent-notch's slot order.+ if (doneUnseen) indicator.append(doneBlob())+ for (const agentId of orderIndicatorAgents(workingAgents)) indicator.append(workingMascot(agentId))}// ---- Expanded panel ------------------------------------------------------------------------@@ -162,7 +181,15 @@ function renderIndicator(rows: HudRow[]): void {function renderPanel(rows: HudRow[]): void {panel.replaceChildren()const shown = rows.slice(0, 6)- for (const row of shown) panel.append(buildRow(row))+ shown.forEach((row, i) => {+ // Dithered pixel separator between rows (agent-notch's DitherSeparator).+ if (i > 0) {+ const sep = document.createElement('div')+ sep.className = 'hud-sep'+ panel.append(sep)+ }+ panel.append(buildRow(row))+ })}function buildRow(row: HudRow): HTMLElement {diff --git a/src/renderer/lib/mascot.ts b/src/renderer/lib/mascot.tsindex 85d641b45..18487b2b9 100644--- a/src/renderer/lib/mascot.ts+++ b/src/renderer/lib/mascot.ts@@ -122,6 +122,55 @@ export const CLAUDE_MASCOT = {frameCount: CLAUDE_FRAMES.length}+// --- "Done, unseen" pixel blob (Notch HUD) -------------------------------------------------+//+// agent-notch draws a shimmering green blob on a 7×7 grid of crisp pixels for a finished-but-+// unseen agent slot. We reproduce the SHAPE as a static 7×7 green circle sprite (crisp pixels via+// image-rendering:pixelated) and let CSS drive the shimmer (opacity pulse) — same reuse pattern as+// the Claude sprite above, so the HUD stays plain-DOM with no per-pixel JS.++/** systemGreen — matches agent-notch's NSColor.systemGreen done blob. */+export const DONE_GREEN = 'rgb(48, 209, 88)'++/** 7×7 filled-circle mask (1 = green pixel). */+export const DONE_BLOB_ART: readonly (readonly number[])[] = [+ [0, 0, 1, 1, 1, 0, 0],+ [0, 1, 1, 1, 1, 1, 0],+ [1, 1, 1, 1, 1, 1, 1],+ [1, 1, 1, 1, 1, 1, 1],+ [1, 1, 1, 1, 1, 1, 1],+ [0, 1, 1, 1, 1, 1, 0],+ [0, 0, 1, 1, 1, 0, 0]+]+export const DONE_BLOB_GRID = 7+const DONE_BLOB_SCALE = 3 // render at 3× (21×21) so the browser downscales by a clean /3++function buildDoneBlobSprite(): string {+ if (typeof document === 'undefined') return '' // no DOM in tests+ const size = DONE_BLOB_GRID * DONE_BLOB_SCALE+ const canvas = document.createElement('canvas')+ canvas.width = size+ canvas.height = size+ const ctx = canvas.getContext('2d')+ if (!ctx) return ''+ ctx.imageSmoothingEnabled = false+ ctx.fillStyle = DONE_GREEN+ for (let y = 0; y < DONE_BLOB_GRID; y++) {+ for (let x = 0; x < DONE_BLOB_GRID; x++) {+ if (DONE_BLOB_ART[y][x]) {+ ctx.fillRect(x * DONE_BLOB_SCALE, y * DONE_BLOB_SCALE, DONE_BLOB_SCALE, DONE_BLOB_SCALE)+ }+ }+ }+ return canvas.toDataURL('image/png')+}++/** Green "done, unseen" pixel blob (7×7). `src` is a data: URI PNG, or '' outside a DOM. */+export const DONE_BLOB = {+ src: buildDoneBlobSprite(),+ grid: DONE_BLOB_GRID+}+// --- Codex pet spritesheet geometry (asset imported by the component) ----------------------/** pet-codex.webp layout: 8 cols × 9 rows of 192×208 frames; walk = the first row. */