Skip to content

Studio: keep Glass cheap on the Linux app by dropping its live blur except the sidebar's - #16957

Merged
danielhanchen merged 2 commits into
mainfrom
studio-glass-webkitgtk-cpu
Nov 6, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
studio-glass-webkitgtk-cpu

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Problem

On the Linux desktop app (WebKitGTK, which paints on the CPU), every live backdrop-filter is re-run on every frame, so a caret blink or a scrolled line re-blurs every glass surface on screen. With Glass on, typing, scrolling Settings and the Glass controls all pay for it. After #16921 (child layers), the remaining WebKit Glass cost is the live blur itself.

Fix

Linux desktop app only. WindowMaterialMount sets data-glass-cpu on <html> when isWebKitGTK(navigator.platform, navigator.userAgent) holds, with the same conditions as the other Glass flags (not Solid, not Transparent, route in scope). All new rules key on it:

  • Live blur is turned off everywhere except the sidebar (and the framed titlebar sidebar), which keeps its real blur and looks exactly as before. Toasts, which set their own blur with !important, are turned off explicitly.
  • Dialogs, menus and toasts get fully opaque fills, so nothing behind them shows through; the composer reaches the 96% fill cap at the default strength; Glass strength cannot drop fills below a readable floor.
  • Every surface that loses its blur on this path is made readable: stuck page headers (Library tabs) get the opaque page background while stuck; menus, selects, popovers and hover cards in light Glass without a wallpaper get the opaque popover colour; tooltips get var(--tooltip-bg); sticky bars inside dialogs, sheets, popovers and the chat settings panel, and the chat settings and browser panels, get opaque fills; light page controls and cards over the image go to 80 to 85% white.
  • Components' own Tailwind backdrop-* blurs (gallery menus, overlays, toolbars) are left alone, as with Glass off.
  • Liquid Glass 3D's wide blurred inner glows are drawn as gradients and its outer shadows use a smaller blur.

macOS (real WebKit with GPU compositing), Windows / Chromium, Glass off and Transparent never get the flag. The change only removes stacking contexts, so no inline dropdown can fall behind a sibling.

What Linux Glass users will notice: the composer is a near-opaque light grey (it keeps its rim) instead of frosted, and dialogs and menus are opaque instead of frosted. The sidebar is unchanged.

Results

Playwright WebKit with a WebKitGTK user agent and platform, CPU-painted, Glass Liquid 3D, 3 reps, medians:

Glass off Glass on, main This PR
Typing, per key 27 ms 31 ms 27 ms
Settings scroll frames p50 / p90 n/a 56 / 68 ms 31 / 42 ms
Settings scroll CPU (40 steps) n/a 15,080 ms 12,150 ms
Tools menu open 248 ms 354 ms 332 ms
Glass strength step n/a 424 ms 298 ms
Style menu open n/a 955 ms 874 ms

With a macOS user agent every number and screenshot matches main, and Chromium is unchanged.

Tests

  • New studio/frontend/tests/glass-webkit-blur.test.ts (8 tests): each readability override, and that each override's selector is the replaced rule's selector plus one attribute so it always wins; the flag is WebKitGTK only and never set for Solid, Transparent or out-of-scope routes; blur is removed except on the sidebar; dialogs and menus are opaque; the shadow replacements; the rules stay at the top level (not inside @layer base). Each test was checked to fail when its rule is broken.
  • 4,397 Glass, backdrop, wallpaper, dialog, WebKit, tooltip, library and menu tests pass; node scripts/typecheck.mjs --tests is clean.

…t the sidebar's

WebKitGTK (the Linux desktop app) runs every backdrop-filter again on each composite, on the CPU, so
with Glass on a caret blink, a scrolled line or a menu frame re-blurred every glass surface on screen.
WindowMaterialMount now sets data-glass-cpu on <html> when isWebKitGTK() holds, under the same
material and scope gate as data-glass-layers. On that path:
- every live backdrop blur is dropped except the sidebar's, which is one static surface over the
  wallpaper and keeps the glass look;
- dialogs and menus get an opaque fill, toasts too, so nothing behind them ghosts through, and the
  composer reaches the 96% cap at the default strength;
- Liquid 3D's wide blurred inner glows become gradients and its lifts use a smaller blur.
macOS WebKit composites backdrops on the GPU and keeps real frosted glass; Chromium/WebView2, Glass
off and Transparent never get the attribute.

Software-rendered WebKit with a WebKitGTK user agent, 3 runs, medians, Glass on before -> after
(Glass off): typing 31 -> 27 ms per key (27), Settings scroll frames 56/68 -> 31/42 ms (p50/p90),
Tools menu 354 -> 332 ms (248), Glass strength step 424 -> 298 ms, Style menu 955 -> 874 ms. With a
macOS user agent every number and screenshot matches main, and Chromium is unchanged.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-06T20:00:01.521424Z
We couldn’t complete this review. Comment @codex review to try again.
188e57f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

… text cannot read through

Dropping the live blur on WebKitGTK left some surfaces with fills meant to sit over a blur:
- stuck page headers (the Library tab row) are transparent, so scrolled text overlapped the tabs;
- plain light glass (no image) gives menus their own ~50% fill on the element, overriding the opaque one;
- tooltips keep a ~54% fill;
- sticky bars inside panels, dialogs, sheets and menus, the chat settings and browser panels, and the
  thin white page controls and cards were in the same position.
On that path each now takes an opaque surface (page, popover, panel or tooltip colour), or for page
controls and cards a dense white, at a specificity one attribute above the rule it replaces. Stuck
headers only: at rest they stay clear as before. Blurs a component sets itself with Tailwind
backdrop-* classes are not Glass's, so the CPU path now leaves them as they are with Glass off.
@danielhanchen
danielhanchen merged commit 0992bd3 into main Nov 6, 2026
@danielhanchen
danielhanchen deleted the studio-glass-webkitgtk-cpu branch November 6, 2026 21:47
imaderaya pushed a commit to pub-forks/unsloth that referenced this pull request Nov 7, 2026
…unslothai#16978)

Follow-up to unslothai#16931. The long-chat gate carried allowances for costs
main had when it landed. unslothai#16938 (the `:has()` rewrite), unslothai#16942 and
unslothai#16957 removed most of those costs, so this lowers the allowances to
today's readings so they cannot creep back.

## Changes

- `tests/studio/has_subject_allowlist.txt`: regenerated. 57 selectors
are still allowed, 61 are gone. Lint on main: 197 `:has()` rules, 57
non-subject, 0 new, 0 stale.
- `tests/studio/_area_matrix.py`:
- All 9 per-area element-count ceilings are removed, so those areas get
the normal 2x growth check. unslothai#16938 fixed every one of them; none
restyles the whole thread on open any more.
- Glass ceilings lowered to about 1.2-1.3x the highest reading on
current main.
- A recheck page that fails to load or measure now keeps the first
verdict instead of crashing the gate with a traceback. A recheck can
only lower a reading, so this never hides a failure.

## Count ceilings removed (elements restyled at 200 turns)

| Area | Old ceiling | Now | 200 vs 40 turns |
|---|---|---|---|
| model_picker | 44000 | 459 | 0.99x |
| chat_options | 17000 | 2091 | 1.45x |
| browser_pane | 45000 | 1259 | up to 2.55x |
| account_menu | 30000 | 346 | 1.0x |
| organize_chats | 30000 | 226 | 1.0x |
| chat_row_menu | 32000 | 1817 | 1.55x |
| sidebar_sections | 45000 | 163 | up to 1.18x |
| sidebar_toggle | 30000 | 365 | 1.06x |
| run_settings | 45000 | 1214 | 2.13x |

browser_pane and run_settings grow a little faster than 2x but stay
under the 3000-element floor (about 4 elements per turn, not a
whole-thread restyle).

## Glass ceilings (ratio vs the default look)

Highest reading over 3 runs pinned to 4 CPUs and 7 runs on a loaded
36-core host.

| Mode | Old | Highest | New |
|---|---|---|---|
| frosted, other areas | 10 | 5.79 | 7 |
| blurred, other areas | 10 | 5.50 | 7 |
| liquid, other areas | 10 | 5.65 | 7 |
| liquid-3d, other areas | 12 | 5.41 | 7 |
| frosted, Settings scroll | 28 | 9.69 | 12 |
| blurred, Settings scroll | 28 | 12.18 | 15 |
| liquid, Settings scroll | 28 | 10.08 | 13 |
| liquid-3d, Settings scroll | 28 | 9.60 | 12 |

## Testing

- Full gate on main: PASS 4 times (270-310 s).
- Still fails when it should:
- a planted subject-after-`:has()` rule is reported by name ("57
allowlisted, 1 new");
- a synthetic Glass material with a 40px backdrop blur fails 8 cells at
4.0-15.7x, with no real mode failing.
- `test_area_matrix.py`, `test_has_lint.py`, `test_css_culprit.py`: 58
passed.
Stanley00 pushed a commit to stanley-fork/unsloth that referenced this pull request Nov 9, 2026
…rain tile (long-chat scroll) (unslothai#17327)

## Problem

On the Linux desktop app (WebKitGTK, where `data-glass-cpu` is set),
scrolling a long chat with Glass on still drops frames: on a GitHub
`ubuntu-latest` runner at 150 turns, 32 to 35 of about 70 scroll frames
take over 50 ms with Liquid 3D. unslothai#16957 already removed the live blur
everywhere on this path except the sidebar. WebKitGTK re-runs every
`backdrop-filter` on each composite, so that one remaining sidebar blur
runs again on every scroll frame. Frosted has a second cost: its grain
texture is an SVG `feTurbulence` background tile on the sidebar and
composer, which WebKitGTK redraws on every paint.

## Change

Only under `html[data-glass-cpu]` (set on WebKitGTK only; macOS, Windows
and Chromium are untouched):

- The sidebar is no longer exempt from the no-live-blur rule, and its
fill is raised to the 96% cap (`--glass-pane-floor: 110%`) so it stays
readable without the blur.
- Frosted's grain tile is dropped (`background-image: none`) on the
sidebar, composer, files panel and the wallpaper preview composer.

## Results

Real runner, `ubuntu-latest`, Playwright WebKit on the app's WebKitGTK
path, 150 turns, Liquid 3D scroll; base run twice as an A/A arm, arms
rotated per runner:

| Runner | base | base (A/A) | this PR |
| --- | --- | --- | --- |
| 1: frame p50 / p95, frames > 50 ms | 47 / 105 ms, 32 | 51 / 106 ms, 35
| 34 / 71 ms, 15 |
| 2 | 22 / 38 ms, 4 | 23 / 40 ms, 4 | 18 / 34 ms, 3 |

Solid and Chromium are unchanged on the same runs. Locally (Playwright
WebKit, GTK path, sum of 178 scroll frame gaps at 150 turns, base 6 runs
vs head 3): Liquid 3D 3424 to 3751 ms -> 3136 to 3284 ms, Frosted 4915
to 7432 ms -> 3177 to 3189 ms (p50 28 to 33 -> 16 ms); every head run
below every base run.

## Look

On the Linux desktop app with Glass, the sidebar is a dense fill instead
of frosted glass, and Frosted loses its grain. Over the default backdrop
the sidebar differs by at most 5 to 6 / 255. Over an image wallpaper the
difference will be visible (not captured here). Left: main. Right: this
PR.

![Liquid 3D, Linux desktop path, main vs this
PR](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17327/pair_top_liquid-3d-aff9058c6c14.png)

![Frosted, Linux desktop path, main vs this
PR](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17327/pair_top_frosted-52dcfca498f8.png)

## Tests

- `tests/glass-webkit-blur.test.ts` updated for the sidebar and the
Frosted grain.
- Frontend node suite passes (one KaTeX test fails only with a shared,
symlinked `node_modules`, the same on main); the Chromium long-chat gate
passes.
- Not covered: a real WebKitGTK desktop / AppImage build (the runner
uses Playwright's WebKitGTK build).
wasimysaid added a commit that referenced this pull request Nov 10, 2026
… browser tab strip on Linux (#17380)

Two rendering defects with Glass on (Liquid Glass / Liquid Glass 3D).

**Diagonal stripes on glass surfaces (macOS and Linux apps, Safari,
Firefox).** The liquid sheen fades about 2% of white out across half the
surface. WebKit and Firefox do not dither gradients, so each 8-bit step
draws as a wide diagonal stripe. In dark theme that is five bands across
the Settings dialog, and the same on the sidebar, the composer and the
browser toolbar. Chromium dithers the same gradient into a fine pixel
pattern, so Windows and Chrome/Edge do not show it. The sheen is now off
on WebKit (`data-glass-layers`) and on Firefox (`@supports
(-moz-appearance: none)`); the rims and the short edge glows are
unchanged, and Chromium keeps the sheen.

**Rings around the welcome greeting with Glass on and no image (reported
on macOS).** The greeting sits on a soft elliptical halo that darkens a
background image behind the text. Glass with no image draws a plain
backdrop in the page colour, so the halo is the same colour as what it
covers: it changes nothing, and blending it rounds a step dark in
places, which draws concentric rings. The halo is now drawn only where
the wallpaper is an image (`data-wallpaper-image`).

**Black strip across the top of the browser pane (Linux app).** On the
WebKitGTK path that drops live blur and uses dense fills (#16957,
#17327), the side panes took a fully opaque fill. The browser's tab
strip is its own layer (`z-40`), and WebKitGTK paints that opaque layer
black when the pane opens, hiding the tabs until something restyles it.
A fill just under opaque, or no `z-index`, draws correctly. The side
panes now use the same 96% cap the sidebar already uses. This change is
limited to `html[data-glass][data-glass-cpu]`.

Validation:

- Native Tauri dev build on Linux, WebKitGTK 2.54.2, NVIDIA, KDE
Wayland, dark theme, Liquid Glass 3D, no wallpaper image.
- Stripes: before, text-free areas of the Settings dialog, sidebar and
composer spanned 3 to 5 brightness levels in diagonal bands; after, each
is a single flat value. Checked in OS screenshots of the Settings
dialog, sidebar, new chat composer and browser pane. That run used the
first commit, which keyed the override on the Linux-only flag; the
second commit keys it on the WebKit flag, which is set under the same
conditions on Linux.
- The same gradient over the same fill on a bare page: Chromium 156
dithers it (no bands), WebKitGTK and Firefox draw clean bands about
130px wide.
- The sheen rules lifted from `index.css` onto a test page (dark Liquid
Glass 3D, a plain surface and a composer surface): Firefox renders both
flat after the change, Chromium still renders the sheen.
- Rings: on the Linux app's page rebuilt in WebKitGTK 2.54.2 with the
plain Glass backdrop, the area around the greeting has 4,844 pixels one
step darker than the page, in concentric ellipses, with the halo and 0
without it. The new selector matches with an image and not with the
plain backdrop. New `tests/welcome-halo-image-only.test.ts`.
- Black strip: reproduced on every open of the browser pane before the
change, in both OS screenshots and the webview's own screenshot, so it
is page paint and not the native page. After the change the tab strip
drew correctly on 3 of 3 reopens.
- Isolated the black strip by reopening the pane with single overrides:
an opaque fill with or without the sheen stayed black; 96% alpha or
`z-index: auto` drew correctly.
- `tests/glass-webkit-blur.test.ts` updated for the pane fill and
extended to pin both sheen overrides; full frontend suite passes.

Not checked: macOS itself (the stripes and the rings there were reported
by macOS users; I have no Mac to confirm either fix on), Studio's own UI
in Firefox (only the test page above), light theme, a wallpaper image,
and pages other than chat and Settings.
wasimysaid added a commit that referenced this pull request Nov 10, 2026
…th and the Windows-style title bar) (#17387)

Since #16957 and #17327, Glass on the Linux desktop app has no live blur
at all: every glass surface is a dense or opaque fill. On a machine with
a GPU that trade buys nothing and Glass stops looking like glass:

- The sidebar, composer, menus, dialogs and side panes no longer frost
what is behind them. Over a wallpaper image the sidebar is a 96% opaque
slab.
- Glass strength does nothing. Dragging it from 0 to 100 on the chat
page changes the computed paint of 0 of 932 elements and 0 pixels,
because there is no blur to scale and every fill sits at its cap.

This removes the WebKitGTK no-blur rule and every fill that compensated
for it, so Linux Glass uses the same blur, fills and strength as macOS
and Windows again.

**Kept from those PRs**, still under `data-glass-cpu`, because they are
paint costs that do not depend on the blur:

- Frosted's grain tile (an SVG `feTurbulence` redrawn on every paint)
stays off.
- Liquid 3D's wide inner glows stay gradients and its lifts keep the
smaller blur.

**Software compositing.** The pause-blur-while-moving path (#17007)
skipped WebKitGTK only because there was no blur left to pause; it no
longer does. One limit: WebKitGTK masks the WebGL renderer string
("Apple GPU"), so `softwareCompositing()` only reports true there when
WebGL is unavailable or the documented override is set. It does not see
llvmpipe.

**The composer's blur was never drawn on Linux (second commit).** With
the blur back, the sidebar frosted the wallpaper but the composer showed
it sharp behind a tint, although both compute the same
`backdrop-filter`. The composer and the files panel each hold a "Drop
files here" overlay that sits at `opacity: 0` with its own
`backdrop-blur-sm` until a file is dragged, and WebKitGTK stops drawing
a surface's own backdrop blur while a hidden child of it carries a
`backdrop-filter`. The overlays now take their blur only in the states
that show them. In the real app, edge detail behind the composer goes
from 24.0 to 1.6 (sidebar 0.8, bare wallpaper 35.2), and putting the
hidden overlay's blur back on the live element returns it to 24.0. New
`tests/glass-hidden-overlay-blur.test.ts` pins it.

**The Linux title bar now matches Windows (third commit).** Linux uses
the same in-page title bar as Windows, but three parts of its Glass
layout were switched on for Windows only: the frame that joins the title
bar strip and the pinned sidebar into one frosted surface with a rounded
inner corner, the browser pane's single glass layer below the caption,
and the wallpaper blur behind non-chat pages. On Linux the strip behind
the window buttons was bare wallpaper. All three now key on
`shouldUseCustomWindowTitlebar()` instead of a Windows check; the
`data-windows-*` attribute names are unchanged. On a rebuilt copy of the
Linux page in WebKitGTK 2.54.2 the frame draws as on Windows (its `mask`
and `backdrop-filter` on one pseudo-element work there), and that build
supports the CSS anchor positioning the page layout uses. The look was
checked by eye in the running Linux app against Windows screenshots.

Measurements, native Tauri dev build, WebKitGTK 2.54.2, KDE Wayland,
Liquid Glass 3D over a wallpaper image, 600-message thread, 238 scripted
scroll frames, three alternating runs each:

| Rendering | Blur | Frame p50 / p90 | Frames over 25 ms |
| --- | --- | --- | --- |
| GPU (NVIDIA) | on (this PR) | 16 / 18 ms | 0 to 9 |
| GPU (NVIDIA) | off | 16 / 17-18 ms | 0 to 9 |
| Software GL (llvmpipe forced) | on (this PR) | 20-22 / 24-28 ms | 18
to 38 |
| Software GL (llvmpipe forced) | off | 16 / 17 ms | 2 to 6 |
| Software GL, motion pause forced on | paused while scrolling | 16 / 17
ms | 1 |

So with a GPU the live blur is free here, and without one this PR costs
about 5 ms a frame on a fast desktop CPU, more on a slower one. That
cost is the trade-off of this change. With the motion pause on,
scrolling is back to 16 ms and the blur returns at rest, so a reliable
software-rendering signal for WebKitGTK (for example from the shell)
would close the gap as a follow-up.

Validation:

- Live in the app: the sidebar and composer compute `blur(...)
saturate(...)` with translucent fills again, and follow Glass strength.
- `tests/glass-webkit-blur.test.ts` rewritten: the flag may only swap
paint costs (no rule under it touches a blur, a fill or the strength
variables); the grain and glow rules are still pinned.
`tests/glass-motion.test.ts` updated for the gating. Full frontend suite
(15,608) and the test typecheck pass.

Not checked: the title bar change on Windows itself (the condition is
still true there, so it should be unchanged), the drop overlays while a
file is actually being dragged, light theme, Frosted and Blurred styles,
a real host without a GPU (software GL was forced on a GPU machine), and
the AppImage build.

Relation to #17380: that PR's side-pane fill change edits a rule this PR
deletes, so whichever lands second needs a small rebase. Its black tab
strip came from the opaque fill removed here. Its sheen fix is still
needed, since the stripes do not depend on the blur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant