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.

fix(glyphgrid): a glyph-attached terminal is a transparent window onto the shared canvas

enesa0c7a77c0376
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index c6980a4a4..60533b522 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -522,6 +522,12 @@ export function TerminalNode({
if (uploadNoteTimer.current) clearTimeout(uploadNoteTimer.current)
}, [])
const [naming, setNaming] = useState(false)
+ // Is a glyph grid attached RIGHT NOW? Drives the `term-node--glyphgrid` class on the node ROOT,
+ // which is what turns the node into a transparent window onto the shared canvas (see styles.css).
+ // React state, not an imperative `classList.add`: the root's className is recomputed from
+ // `selected`/`unread`/`working`/… on many renders and React rewrites the whole attribute when it
+ // changes, so a class added behind React's back would be wiped by the next selection change.
+ const [glyphMounted, setGlyphMounted] = useState(false)
const [mdHtml, setMdHtml] = useState('')
const [editingTitle, setEditingTitle] = useState(false)
const hoveredRef = useRef(false)
@@ -1075,6 +1081,9 @@ export function TerminalNode({
glyphGrid = null
if (glyphGridRef.current === grid) glyphGridRef.current = null
if (!attach && !grid) return true
+ // The node goes opaque again in the same commit the rows come back — skipped on the unmount
+ // path, where there is no component left to render it.
+ if (!disposed) setGlyphMounted(false)
term.element?.classList.remove('glyphgrid-mode')
const restored = attach ? attach.dispose() : true
grid?.dispose()
@@ -1148,6 +1157,9 @@ export function TerminalNode({
glyphAttach = attached
glyphGridRef.current = handle
host.classList.add('glyphgrid-mode')
+ // …and the node root gives up its background so the shared canvas shows through; the grid's
+ // own opaque plate is the terminal body's background from here on.
+ setGlyphMounted(true)
// Paint order. The engine change-gates `setZ`, so a reorder that does not move this node
// costs one comparison.
glyphZUnsub = subscribeNodeZOrder(() => handle.setZ(nodeZFor(id)))
@@ -2252,7 +2264,7 @@ export function TerminalNode({
isUnread ? ' unread' : ''
}${status?.state === 'working' ? ' working' : ''}${
status?.state === 'waiting' || status?.state === 'blocked' ? ' attention' : ''
- }`}
+ }${glyphMounted ? ' term-node--glyphgrid' : ''}`}
style={{ borderTopColor: data.color }}
onMouseEnter={() => (hoveredRef.current = true)}
onMouseLeave={() => (hoveredRef.current = false)}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index eb514ee6b..b5bbd20fe 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -1613,9 +1613,36 @@ body,
height: 100%;
}
-/* Shared glyph renderer (experimental, `glyphgrid`): this terminal's text is painted by the one
- GPU canvas in the React Flow pane, so xterm's own text layers must not paint on top of it. The
- class is added to the `.xterm` element only while a glyph grid is actually attached, and removed
+/* Shared glyph renderer (experimental, `glyphgrid`): a glyph-attached terminal becomes a
+ transparent WINDOW onto the one GPU canvas, which sits between the React Flow background and the
+ nodes (z-index 0 against the renderer's 4 — it cannot simply be raised above them, or a
+ terminal's glyphs would paint over any sticky / editor / subagent chrome that overlaps its body
+ rect; the plate only orders terminals among themselves). So the node root and its body give up
+ their backgrounds, and the grid's own opaque PLATE — the packed theme background, expanded by
+ padPx — becomes the terminal body's background. That is precisely what the plate is for.
+
+ The class is on the root only while a grid is ACTUALLY attached, so collapse, the ⌘M view, a
+ failed attach and every default renderer mode leave the node opaque exactly as today.
+
+ Nothing else needs restoring: every child that covers ground outside the plate already paints its
+ own background (`.term-node__header` var(--panel-header), `.node-tags` var(--panel),
+ `.term-node__find` #2a2a2a, and the body's own overlays). The selection ring and the unread glow
+ are border-color + box-shadow, both independent of the background.
+
+ TWO accepted degradations, both plate GEOMETRY, both Phase 2's call (a rounded / stencilled
+ plate) and both judged on the device checklist:
+ 1. the plate is a square rect while the node has border-radius 10px, so the body's corners read
+ square in shared mode;
+ 2. the plate covers the grid plus padPx, and a fit leaves up to one cell of slack at the right
+ and bottom of the body — that slack shows the canvas behind the node rather than the
+ terminal background. */
+.term-node--glyphgrid,
+.term-node--glyphgrid .term-node__body {
+ background: transparent;
+}
+
+/* …and xterm's own text layers must not paint over the canvas now showing through. This class is
+ added to the `.xterm` element only while a glyph grid is actually attached, and removed
the moment it detaches — no default renderer mode ever matches this rule.
`visibility: hidden`, NOT `display: none`: these elements still have to be LAID OUT. xterm