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(glass): stop sharp backdrop leaking through glass rims

iceclatterWTb34ba126e1f8
diff --git a/src/renderer/components/GlassRefraction.tsx b/src/renderer/components/GlassRefraction.tsx
index 98440e279..a5c21761b 100644
--- a/src/renderer/components/GlassRefraction.tsx
+++ b/src/renderer/components/GlassRefraction.tsx
@@ -6,6 +6,14 @@ import { glassRefraction } from '../lib/glassContrast'
* neutral in the middle and pushes the backdrop outward near the edges, so the picture bends at a
* surface's rim the way it does under Apple's glass. `primitiveUnits="objectBoundingBox"` scales it
* to whatever element uses it, so one filter serves nodes, menus and the tab bar alike.
+ *
+ * It runs LAST in the backdrop chain (styles.css `--glass-blur`), so it bends pixels that are
+ * already blurred, and its output is opaque everywhere: where the lens samples outside the element
+ * (transparent), the undisplaced pixel fills in (`feComposite … over SourceGraphic`). Any
+ * transparency here, or a reference filter ahead of blur(), lets Chromium show the SHARP backdrop
+ * through a band at the rim — the old in-filter soft blur (default edgeMode) plus first-in-chain
+ * order leaked terminal text through every menu edge. The soft blur is gone: the CSS blur before
+ * it already does that job.
*/
let mapUrl: string | null = null
@@ -50,8 +58,15 @@ export function GlassRefraction({ slider }: { slider: number }) {
primitiveUnits="objectBoundingBox"
>
<feImage href={map} x="0" y="0" width="1" height="1" preserveAspectRatio="none" result="map" />
- <feGaussianBlur in="SourceGraphic" stdDeviation="0.004" result="soft" />
- <feDisplacementMap in="soft" in2="map" scale={glassRefraction(slider)} xChannelSelector="R" yChannelSelector="G" />
+ <feDisplacementMap
+ in="SourceGraphic"
+ in2="map"
+ scale={glassRefraction(slider)}
+ xChannelSelector="R"
+ yChannelSelector="G"
+ result="bent"
+ />
+ <feComposite in="bent" in2="SourceGraphic" operator="over" />
</filter>
</svg>
)
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 5fe789f4b..717e129b5 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -1567,8 +1567,9 @@ body,
background: transparent;
}
/* The blur is re-rasterised for every glass node on every frame of a pan/zoom (their backdrop
- moves under them). Canvas marks the flow wrapper while the camera moves; the tint stays, and the
- tint alone is what keeps text at 4.5:1, so only the frosting pauses. */
+ moves under them). With Keep blur while moving OFF (settings.glassBlurWhileMoving), Canvas marks
+ the flow wrapper while the camera moves; the tint stays, and the tint alone is what keeps text at
+ 4.5:1, so only the frosting pauses. With it on (the default) the class is never set. */
.canvas-moving .term-node.term-node--glass {
-webkit-backdrop-filter: none;
backdrop-filter: none;
@@ -13537,8 +13538,9 @@ body.focus-mode .dock:hover {
explicitly; `!important` because the minimap's own rule already carries it.
- backdrop-filter goes on OUTERMOST containers only. A blur inside another blurred element
re-blurs its parent's already-blurred pixels (and costs a second pass), so nested pieces take
- the fill alone. Node blur pauses while the camera moves (`.canvas-moving`); chrome is static
- and keeps its blur. */
+ the fill alone. Node blur pauses while the camera moves (`.canvas-moving`) only when Keep blur
+ while moving is off (Canvas never sets the class otherwise); chrome is static and keeps its
+ blur. */
:root[data-nt-glass='on'] {
--panel: var(--glass-chrome-bg);
--panel-header: var(--glass-chrome-bg);
@@ -13551,15 +13553,21 @@ body.focus-mode .dock:hover {
/* The Glass slider (App.tsx sets the live values inline; these are the Readable-tick defaults):
`--glass-t` 0 = Clear … 1 = Tinted.
Clearer glass blurs a little less and saturates a little more, and refracts at its rim
- (`#nt-refract`, components/GlassRefraction.tsx — its strength also follows the slider). */
+ (`#nt-refract`, components/GlassRefraction.tsx — its strength also follows the slider).
+ The refraction runs LAST, on already-blurred pixels. First in the chain it left a 20–40px band
+ of sharp, unblurred backdrop inside every rim (text readable through a menu's edge, at every
+ slider position): a reference filter ahead of blur() makes Chromium blend the unfiltered
+ backdrop back in near the edges. Measured on an empty menu over terminal text (high-frequency
+ energy of a 20px rim band): Clear 2.55 → 0.20, Readable 1.90 → 0.07 — now equal to the
+ menu's own interior, i.e. no sharper at the rim than in the middle. */
--glass-t: 0.7;
--glass-refract: url(#nt-refract);
- --glass-blur: var(--glass-refract) blur(calc(16px + 12px * var(--glass-t)))
- saturate(calc(200% - 55% * var(--glass-t)));
+ --glass-blur: blur(calc(16px + 12px * var(--glass-t))) saturate(calc(200% - 55% * var(--glass-t)))
+ var(--glass-refract);
/* Terminal nodes frost 15% less than the chrome (the user asked for less blur under the terminal
windows): same curve, radius × 0.85, same saturation and refraction. */
- --glass-term-blur: var(--glass-refract) blur(calc((16px + 12px * var(--glass-t)) * 0.85))
- saturate(calc(200% - 55% * var(--glass-t)));
+ --glass-term-blur: blur(calc((16px + 12px * var(--glass-t)) * 0.85))
+ saturate(calc(200% - 55% * var(--glass-t))) var(--glass-refract);
}
/* Outermost chrome: fill + blur. */
diff --git a/src/renderer/styles.palette.test.ts b/src/renderer/styles.palette.test.ts
index f3abf22ae..4fad500cb 100644
--- a/src/renderer/styles.palette.test.ts
+++ b/src/renderer/styles.palette.test.ts
@@ -251,6 +251,15 @@ describe('terminal glass blur', () => {
const reduce = CSS.slice(CSS.indexOf('@media (prefers-reduced-transparency: reduce) {'))
expect(reduce.slice(0, reduce.indexOf('}'))).toMatch(/--glass-term-blur:\s*none/)
})
+
+ // Refraction first in the chain leaked a band of SHARP backdrop inside every rim (visual QA C1:
+ // terminal text readable through a menu's edge at every slider position). It must bend pixels
+ // that are already blurred.
+ it.each(['--glass-blur', '--glass-term-blur'])('%s refracts last, after the blur', (name) => {
+ const chain = blocks(":root[data-nt-glass='on']").get(name)!.replace(/\s+/g, ' ')
+ expect(chain.indexOf('blur(')).toBe(0)
+ expect(chain.trim().endsWith('var(--glass-refract)')).toBe(true)
+ })
})
describe('glass rim light', () => {