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(notch-hud): DynamicNotch capsule — mascots live INSIDE the notch
enesbe8737ab3efc
diff --git a/docs/notch-hud.md b/docs/notch-hud.mdindex 9c3056e4c..a54c18c30 100644--- a/docs/notch-hud.md+++ b/docs/notch-hud.md@@ -15,12 +15,15 @@ alwaysOnTop:true, focusable:false, skipTaskbar:true}` + `setAlwaysOnTop(true,'sc{forward:true})`. Its own renderer entry `hud.html` (add to electron.vite.config.ts`renderer.input`) sharing the existing preload plus a small HUD-specific API.-- **Geometry** from `screen.getPrimaryDisplay()`: strip at `bounds.y`, full `bounds.width`, height- = notch bar height (`workArea.y - bounds.y`, floor 24). The notch is centered at `bounds.width/2`;- Electron exposes no `auxiliaryTopLeftArea`, so assume a centered notch and place the mascot slot- just LEFT of center (fake notch width ~200 px when `workArea.y === bounds.y`, i.e. no physical- notch → center on a virtual pill). Re-assert on `screen` `display-metrics-changed` +- `display-added/removed`.+- **Geometry** from `screen.getPrimaryDisplay()`: the window spans the full top edge (`bounds`,+ `y = bounds.y`), sized to the EXPANDED box (`HUD_WINDOW_HEIGHT`); we never resize the frame. Main+ sends the renderer everything it needs to draw the capsule: `bar` (= `workArea.y - bounds.y`,+ floor `NOTCH_BAR_FLOOR` 24 — the fused top zone height), `width`, `notchWidth` (= `NOTCH_WIDTH`,+ ~200, a tunable — Electron exposes no `auxiliaryTopLeftArea`, so assume a centered notch of this+ width), `notchCenterX` (= `bounds.width/2`), and `hasNotch` (`inset > 0 && inset >= NOTCH_MIN_BAR`+ 32 — a notched Mac's menu bar is ~37 px vs ~24 on a notchless display; when false the renderer+ draws a standalone floating pill instead of fusing). Re-asserted on `screen`+ `display-metrics-changed` + `display-added/removed`.- **Click-through with a hotspot**: window stays mouse-ignoring; the renderer reports pointerenter/leave of the indicator rect over IPC → main toggles `setIgnoreMouseEvents(false/true,{forward:true})`. Click in the hotspot → expand; click outside the expanded panel → collapse@@ -50,21 +53,49 @@ Row shape sent to the HUD:panel is opened — a nodeterm-native "you looked at it" signal (better than agent-notch'sterminal-bundle-id sniff). Drop a node from the HUD when it's gone + idle > 6 h.-## Indicator + panel (hud renderer)+## Indicator + panel (hud renderer) — the DynamicNotch capsuleReuse `src/renderer/lib/mascot.ts` (`CLAUDE_MASCOT` data-URI + `CODEX_MASCOT` geometry +`pet-codex.webp`) and the walk-cycle CSS from AgentMascot/styles.css — plain DOM, no Reactcoupling needed (React optional; keep the HUD lean). Master clock 120 ms.-- **Indicator (collapsed)**: right-aligned toward the notch — a slot per agent kind that has a- working/done node: claude → 2-frame coral pixel mascot walking (2.5 fps); codex → the pet- spritesheet first-row crop (8 frames, 120 ms, `image-rendering: pixelated`); a shimmering green- blob for a done-unseen slot. Nothing shown when all idle.-- **Panel (expanded)**: up to ~6 session rows, newest-active first. Each row: animated mascot/green- check + title + `model · reltime` tag (blue working / gray idle / green done) + a `You: <prompt>`- (or `activity`) second line + a `▸ N subagents` disclosure (child rows: label + state). A **Go**- button (or row-tap) → IPC → main mirrors the notification-click handler:++The HUD is **one black rounded-bottom capsule (`.hud-capsule`) that EXTENDS the physical notch** —+fused, seamless: its TOP edge is at `y=0` sharing the notch's black (top corners SQUARE), only the+BOTTOM corners are rounded (`--capsule-radius`), and it is anchored at the notch's horizontal center+(`left: var(--notch-center-x); translateX(-50%)`). The mascots/rows live INSIDE it. The capsule IS+the click-through hotspot (`pointerenter` → main `setIgnoreMouse(false)`, leave → `true` + collapse);+the transparent rest of the window stays click-through. Hidden entirely when idle (no empty pill).++- **Collapsed capsule**: width = `--notch-width` (so it reads as the notch itself), height =+ `--bar + --capsule-drop` — it hangs `--capsule-drop` (~28 px) BELOW the menu-bar line, the classic+ Dynamic-Island bulge. The indicator content is pushed past the fused top zone+ (`padding-top: var(--bar)`) so the **mascots sit in that drop zone, below the bar line** — the+ intended content zone (this is what fixes the old "mascots floating below the bar, beside the+ notch" reading: the black capsule now frames them there, reading as the notch swelling). A slot per+ agent kind that is working: claude → 2-frame coral pixel mascot walking; codex → the pet+ spritesheet first-row crop (`image-rendering: pixelated`); plus a shimmering green blob for a+ done-unseen slot and a red "needs you" dot for a waiting session (so the capsule is never an empty+ black pill). Nothing shown when all idle.+- **Expanded panel**: clicking grows the SAME black surface — width → `--panel-width`, height+ (driven by `max-height`, so content of unknown height animates) → the rows box, bottom corners+ still rounded, top still fused — a spring-ish `--capsule-dur` (~220 ms) `--capsule-ease` expand+ from the notch, NOT a separate floating panel. Rows fade in and start below the bar line+ (`padding-top: calc(var(--bar) + 4px)`). Up to ~6 session rows, newest-active first. Each row:+ animated mascot/green check + title + `model · reltime` tag (blue working / gray idle / green+ done) + a `You: <prompt>` (or `activity`) second line + a `▸ N subagents` disclosure (child rows:+ label + state). A **Go** button (or row-tap) → IPC → main mirrors the notification-click handler:`getMainWindow().show()/focus()` + `sendToMain(app:focus-node, nodeId)` → `Canvas.focusNodeById`,and clears that node's done latch.+- **Notchless fallback** (`hasNotch === false`, e.g. an external monitor or a display with no menu+ bar): the `.notchless` root class draws the capsule as a **standalone floating pill** — a small+ `--pill-top-gap` above it and all-corner `--pill-radius`, since there is no notch to fuse with.+ Collapsed height = `--pill-height`; the mascots center in the pill (no `--bar` padding to clear).++**Tunables** (main constants in `notch-hud.ts`; CSS vars in `hud.css :root`, defaults in parens —+tune on a Mac): `NOTCH_WIDTH` (200) / `--notch-width`, `NOTCH_MIN_BAR` (32, notch-detection+threshold), `NOTCH_BAR_FLOOR` (24), `--capsule-drop` (28 px bulge — must exceed the tallest mascot),+`--capsule-radius` (16), `--panel-width` (400), `--panel-max-h` (420), `--capsule-dur`/`--capsule-ease`,+and the notchless `--pill-top-gap` (6) / `--pill-radius` (18) / `--pill-height` (30).## Settings + lifecyclediff --git a/src/main/notch-hud.ts b/src/main/notch-hud.tsindex d7b9fa329..5e2490c1b 100644--- a/src/main/notch-hud.ts+++ b/src/main/notch-hud.ts@@ -25,6 +25,18 @@ import { createHudModel, type HudModel } from './notch-hud-model'/** Minimum strip height when there is no physical notch (menu-bar height floor). */const NOTCH_BAR_FLOOR = 24+/**+ * Assumed physical notch WIDTH (px). Electron exposes no `auxiliaryTopLeftArea`, so we assume a+ * centered notch of this width and FUSE the capsule to it (its collapsed width). ~200 px covers the+ * 14"/16" MacBook notch. TUNE ON A MAC if the capsule reads narrower/wider than the physical notch.+ */+const NOTCH_WIDTH = 200+/**+ * A top inset (`workArea.y - bounds.y`) at least this tall (px) means a PHYSICAL notch is present:+ * a notched Mac's menu bar is ~37 px, a notchless display's is ~24–25 px. Below this we treat the+ * display as notchless and draw a standalone floating pill instead of fusing to a notch. TUNABLE.+ */+const NOTCH_MIN_BAR = 32/** Total window height — sized to the EXPANDED box (we never resize the frame; the renderer scales* a CSS transform). Capped to the display height. */const HUD_WINDOW_HEIGHT = 460@@ -196,15 +208,37 @@ class NotchHudController {this.ipcBound = false}- private geometry(): { x: number; y: number; width: number; height: number; bar: number } {+ private geometry(): {+ x: number+ y: number+ width: number+ height: number+ bar: number+ notchWidth: number+ notchCenterX: number+ hasNotch: boolean+ } {const d = screen.getPrimaryDisplay()const b = d.boundsconst wa = d.workArea// The notch bar height is the strip between the display top and the usable work area// (menu-bar / notch). Floor at 24 so we always have room for the mascots.- const bar = Math.max(NOTCH_BAR_FLOOR, wa.y - b.y)+ const inset = wa.y - b.y+ const bar = Math.max(NOTCH_BAR_FLOOR, inset)const height = Math.min(HUD_WINDOW_HEIGHT, b.height)- return { x: b.x, y: b.y, width: b.width, height, bar }+ // A physical notch is present only when the display actually has a menu bar (inset > 0) AND that+ // inset is as tall as a notched Mac's menu bar. Otherwise the renderer draws a floating pill.+ const hasNotch = inset > 0 && inset >= NOTCH_MIN_BAR+ return {+ x: b.x,+ y: b.y,+ width: b.width,+ height,+ bar,+ notchWidth: NOTCH_WIDTH,+ notchCenterX: Math.round(b.width / 2),+ hasNotch+ }}private reposition(): void {@@ -290,7 +324,14 @@ class NotchHudController {this.model.prune(now)const rows = this.model.buildRows(now, this.deps.getNodeTitle)const g = this.geometry()- w.webContents.send(IPC.hudRows, { rows, bar: g.bar, width: g.width })+ w.webContents.send(IPC.hudRows, {+ rows,+ bar: g.bar,+ width: g.width,+ notchWidth: g.notchWidth,+ notchCenterX: g.notchCenterX,+ hasNotch: g.hasNotch+ })}}diff --git a/src/preload/hud.ts b/src/preload/hud.tsindex cdc45008c..72894fc9e 100644--- a/src/preload/hud.ts+++ b/src/preload/hud.ts@@ -24,10 +24,16 @@ export interface HudRow {}export interface HudPush {rows: HudRow[]- /** Notch/menu-bar strip height in px (indicator vertical placement). */+ /** Notch/menu-bar strip height in px (the capsule's fused top zone; content sits below it). */bar: number/** Primary-display width in px. */width: number+ /** Assumed physical notch width in px — the capsule's collapsed (fused) width. */+ notchWidth: number+ /** Notch horizontal center in px (= width / 2) — where the capsule anchors. */+ notchCenterX: number+ /** True when a physical notch is present (fuse to it); false = draw a standalone floating pill. */+ hasNotch: boolean}export interface HudApi {diff --git a/src/renderer/hud/hud.css b/src/renderer/hud/hud.cssindex 440820a59..47b30af28 100644--- a/src/renderer/hud/hud.css+++ b/src/renderer/hud/hud.css@@ -4,6 +4,27 @@/* 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;++ /* --- DynamicNotch capsule geometry — TUNE ON A MAC ---------------------------------------+ A single black rounded-bottom surface that EXTENDS the physical notch (fused, seamless): its+ top edge sits at y=0 sharing the notch's black, its bottom corners are rounded, and the+ walking mascots live inside the few px that hang BELOW the menu-bar line. Clicking it grows the+ SAME surface downward into the session panel. `--bar`, `--notch-width` and `--notch-center-x`+ are pushed from main (notch-hud.ts geometry); the rest are visual tunables. */+ --bar: 32px; /* menu-bar / notch strip height (from main) — the fused top zone */+ --notch-width: 200px; /* physical notch width (from main) = the capsule's collapsed width */+ --notch-center-x: 50%; /* notch horizontal center in px (from main) — the capsule anchor */+ --capsule-drop: 28px; /* how far the collapsed capsule bulges BELOW the bar line (holds mascots) */+ --capsule-radius: 16px; /* bottom-corner radius of the fused capsule */+ --panel-width: 400px; /* expanded panel width */+ --panel-max-h: 420px; /* expanded panel max content height (rows scroll past it) */+ --capsule-bg: #000; /* opaque black — fuses with the physical notch (no seam) */+ --capsule-ease: cubic-bezier(0.22, 1, 0.36, 1); /* spring-ish grow */+ --capsule-dur: 0.22s;+ /* Notchless fallback (no physical notch): a standalone floating pill. */+ --pill-top-gap: 6px; /* gap above the floating pill */+ --pill-radius: 18px; /* all-corner radius of the floating pill */+ --pill-height: 30px; /* collapsed floating-pill height */}* {@@ -29,39 +50,78 @@ body {height: 100%;}-/* The interactive hotspot: the indicator + (when expanded) the panel. The notch is centered on- the display (left:50%); COLLAPSED, the hotspot sits just LEFT of it — its right edge lands at- the notch's left edge, so the mascots walk beside the notch, not on top of it. translateX(-50%)- alone (the old value) only centered the hotspot ON the notch. `--notch-half-w` is half the- notch's width (main can override; ~100px covers 14"/16" MacBooks, and on a notchless display it- just parks the mascots left of the virtual center). EXPANDED, the panel re-centers under the- notch. */-.hud-hotspot {+/* The DynamicNotch capsule: one black surface anchored at the notch's horizontal center, its TOP+ edge at y=0 so it shares (fuses with) the notch's black — top corners SQUARE, bottom corners+ rounded, so the top blends into the notch and only the bottom reads as a rounded pill. COLLAPSED+ it is `--notch-width` wide and hangs `--capsule-drop` px below the bar line (the Dynamic-Island+ bulge that holds the mascots). EXPANDED the SAME surface grows to `--panel-width` wide and taller,+ revealing the session rows — a smooth width+height expand from the notch, not a separate panel.+ `max-height` (not `height`) drives the vertical grow so the reveal animates with content of+ unknown height. */+.hud-capsule {position: absolute;- left: 50%;top: 0;- transform: translateX(calc(-100% - var(--notch-half-w, 100px)));+ left: var(--notch-center-x, 50%);+ transform: translateX(-50%);+ width: var(--notch-width, 200px);+ height: auto;+ max-height: calc(var(--bar) + var(--capsule-drop));+ overflow: hidden;+ background: var(--capsule-bg);+ /* Top corners square (blend into the notch); bottom corners rounded. */+ border-radius: 0 0 var(--capsule-radius) var(--capsule-radius);+ box-shadow: 0 12px 44px rgba(0, 0, 0, 0.55);display: flex;flex-direction: column;- align-items: flex-end; /* indicator hugs the notch side */- transition: transform 0.2s ease;-}-.hud-hotspot.expanded {- transform: translateX(-50%);align-items: center;+ will-change: width, max-height;+ transition:+ width var(--capsule-dur) var(--capsule-ease),+ max-height var(--capsule-dur) var(--capsule-ease),+ border-radius var(--capsule-dur) var(--capsule-ease);+}+.hud-capsule--hidden {+ display: none; /* idle: no empty black pill */+}+.hud-capsule.expanded {+ width: var(--panel-width);+ max-height: calc(var(--bar) + var(--panel-max-h) + 20px);+}++/* Notchless display: a standalone floating pill (no notch to fuse with) — a small top gap and+ all-corner radius so it reads as its own Dynamic-Island-like element, not a black bar at y=0. */+.notchless .hud-capsule {+ top: var(--pill-top-gap);+ max-height: var(--pill-height);+ border-radius: var(--pill-radius);+}+.notchless .hud-capsule.expanded {+ max-height: calc(var(--panel-max-h) + 16px);+ border-radius: var(--pill-radius);}-/* --- Collapsed indicator --- */+/* --- Collapsed indicator: the mascots, centered in the drop zone BELOW the menu-bar line ---+ `padding-top: var(--bar)` pushes the mascots past the fused top zone (the physical notch), so+ they sit in the few px of capsule that hang below the bar — exactly where a Dynamic Island shows+ content. This is the intended zone (fixes the old "floating below the bar" reading: the black+ capsule now frames them there). Hidden when expanded (the rows carry their own icons). */.hud-indicator {display: flex;align-items: center;+ justify-content: center;gap: 8px;- height: var(--bar, 32px);- padding: 0 10px;+ width: 100%;+ height: calc(var(--bar) + var(--capsule-drop));+ padding-top: var(--bar);+ padding-bottom: 3px;}-.hud-indicator:empty {+.hud-capsule.expanded .hud-indicator {display: none;}+.notchless .hud-indicator {+ height: var(--pill-height);+ padding-top: 0; /* no notch to clear — center in the pill */+}/* --- Walking mascots (copied from styles.css .term-node__mascot*) --- */.mascot {@@ -152,35 +212,27 @@ body {}}-/* --- Expanded panel --- */+/* --- Expanded panel: the session rows, INSIDE the same black capsule ---+ No own background / border / radius — it IS the capsule's black surface. Rows start below the+ fused top zone (padding-top clears the notch/menu-bar line). Fades in as the capsule grows. */.hud-panel {- margin-top: 2px;- width: 400px;- max-height: 420px;+ width: 100%;+ max-height: var(--panel-max-h);overflow-y: auto;- padding: 8px 10px;- border-radius: 14px;- /* 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);+ padding: 4px 10px 10px;+ padding-top: calc(var(--bar) + 4px);font-family: var(--hud-mono);color: #f2f2f7;- /* Collapsed by default: scaled to nothing from the top center. */- transform-origin: top center;- transform: scaleY(0.06) scaleX(0.25);+ display: none;opacity: 0;- pointer-events: none;- transition:- transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),- opacity 0.18s ease;+ transition: opacity 0.16s ease 0.06s;+}+.notchless .hud-panel {+ padding-top: 8px; /* no notch to clear */}-.hud-hotspot.expanded .hud-panel {- transform: scale(1);+.hud-capsule.expanded .hud-panel {+ display: block;opacity: 1;- pointer-events: auto;}.hud-row {diff --git a/src/renderer/hud/main.ts b/src/renderer/hud/main.tsindex 62445a196..e2a190c93 100644--- a/src/renderer/hud/main.ts+++ b/src/renderer/hud/main.ts@@ -31,6 +31,9 @@ interface HudPush {rows: HudRow[]bar: numberwidth: number+ notchWidth: number+ notchCenterX: number+ hasNotch: boolean}interface HudApi {onRows(cb: (push: HudPush) => void): () => void@@ -47,15 +50,18 @@ declare global {const root = document.getElementById('hud') as HTMLDivElement-// The single interactive hotspot (indicator + panel).-const hotspot = document.createElement('div')-hotspot.className = 'hud-hotspot'+// One black rounded-bottom surface — the DynamicNotch capsule — fused to the physical notch. It IS+// the interactive hotspot: the walking mascots live INSIDE it (collapsed), and clicking it grows+// the SAME surface downward into the session panel (expanded).+const capsule = document.createElement('div')+// Start hidden so there is no flash of an empty black pill before the first rows push.+capsule.className = 'hud-capsule hud-capsule--hidden'const indicator = document.createElement('div')indicator.className = 'hud-indicator'const panel = document.createElement('div')panel.className = 'hud-panel'-hotspot.append(indicator, panel)-root.append(hotspot)+capsule.append(indicator, panel)+root.append(capsule)let expanded = falselet latestRows: HudRow[] = []@@ -64,13 +70,14 @@ const openSubs = new Set<string>()// ---- Interaction: click-through hotspot + expand/collapse -----------------------------------// While the window is click-through (setIgnoreMouse(true,{forward:true})), the OS still forwards-// MOVE events, so pointerenter fires and we can flip click-through OFF to accept clicks. Leaving-// the hotspot re-enables click-through and collapses the panel (the click-away).-hotspot.addEventListener('pointerenter', () => {+// The capsule IS the hotspot. While the window is click-through (setIgnoreMouse(true,{forward:true})),+// the OS still forwards MOVE events, so pointerenter fires and we flip click-through OFF to accept+// clicks. Leaving the capsule re-enables click-through and collapses the panel (the click-away). The+// transparent rest of the window stays click-through throughout.+capsule.addEventListener('pointerenter', () => {window.hud.setIgnoreMouse(false)})-hotspot.addEventListener('pointerleave', () => {+capsule.addEventListener('pointerleave', () => {window.hud.setIgnoreMouse(true)if (expanded) setExpanded(false)})@@ -79,7 +86,7 @@ indicator.addEventListener('click', () => setExpanded(!expanded))function setExpanded(next: boolean): void {if (expanded === next) returnexpanded = next- hotspot.classList.toggle('expanded', expanded)+ capsule.classList.toggle('expanded', expanded)window.hud.setExpanded(expanded)}@@ -162,16 +169,26 @@ function renderIndicator(rows: HudRow[]): void {indicator.replaceChildren()const workingAgents: string[] = []let doneUnseen = false+ let needsYou = falsefor (const r of rows) {if (r.state === 'working') {const id = r.agentId || 'unknown'if (!workingAgents.includes(id)) workingAgents.push(id)} else if (r.state === 'done') {doneUnseen = true+ } else if (r.state === 'needsYou') {+ needsYou = true}}- // 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.+ // Left→right paint order, centered inside the capsule's drop zone: a red "needs you" dot and the+ // green "done" blob sit furthest left, then the working mascots with Claude last (notch-side).+ // Surfacing needsYou here keeps the collapsed capsule meaningful (never an empty black pill) for a+ // session that is waiting on the user even when nothing is actively working.+ if (needsYou) {+ const d = document.createElement('span')+ d.className = 'needs-dot'+ indicator.append(d)+ }if (doneUnseen) indicator.append(doneBlob())for (const agentId of orderIndicatorAgents(workingAgents)) indicator.append(workingMascot(agentId))}@@ -291,12 +308,19 @@ function render(rows: HudRow[]): void {latestRows = rowsrenderIndicator(rows)renderPanel(rows)+ // Idle → hide the whole capsule (no empty black pill); active → the fused capsule shows.+ capsule.classList.toggle('hud-capsule--hidden', rows.length === 0)// Auto-collapse if there is nothing to show.if (rows.length === 0 && expanded) setExpanded(false)}function applyGeometry(push: HudPush): void {- document.documentElement.style.setProperty('--bar', `${push.bar}px`)+ const rs = document.documentElement.style+ rs.setProperty('--bar', `${push.bar}px`)+ if (typeof push.notchWidth === 'number') rs.setProperty('--notch-width', `${push.notchWidth}px`)+ if (typeof push.notchCenterX === 'number') rs.setProperty('--notch-center-x', `${push.notchCenterX}px`)+ // No physical notch → draw a standalone floating pill instead of fusing to y=0.+ document.documentElement.classList.toggle('notchless', push.hasNotch === false)}window.hud.onRows((push: HudPush) => {