Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: restore real Glass on the Linux app (live blur, fills, strength and the Windows-style title bar) (#17387)

Wasim Yousef Said3a6cd4e2ea46
diff --git a/studio/frontend/src/app/routes/__root.tsx b/studio/frontend/src/app/routes/__root.tsx
index 4bf6f7ff701..15a2ddbf0e2 100644
--- a/studio/frontend/src/app/routes/__root.tsx
+++ b/studio/frontend/src/app/routes/__root.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import { usesWindowsTitlebar } from "@/components/tauri/window-titlebar";
+import { shouldUseCustomWindowTitlebar } from "@/components/tauri/window-titlebar";
import {
ChatBackground,
WindowMaterialMount,
@@ -434,7 +434,8 @@ function RootLayout() {
const videoDisabled =
videoNavHint(chatOnlyMeasured, chatOnlyReason, videoCpuOptIn, cpuTraining) !== undefined;
const isChatRoute = pathname === "/chat";
- const windowsTitlebar = usesWindowsTitlebar();
+ // The in-page titlebar, shared by Windows and Linux; the data-windows-* names predate Linux using it.
+ const windowsTitlebar = shouldUseCustomWindowTitlebar();
const windowsWallpaperPage = !isChatRoute && windowsTitlebar;
const { pinned, setPinned, togglePinned } = useSidebarPin();
const navigate = useNavigate();
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index df495a66dae..86063d5f753 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -81,7 +81,6 @@ import { useAnimatedThemeToggle } from "@/components/ui/animated-theme-toggler";
import {
DesktopTitlebarNavigation,
shouldUseCustomWindowTitlebar,
- usesWindowsTitlebar,
shouldUseNativeMacWindowTitlebar,
} from "@/components/tauri/window-titlebar";
// deep imports avoid the Images index because its ImagesPage re-export would undo the code split.
@@ -5885,7 +5884,7 @@ export function AppSidebar() {
<Sidebar
collapsible="icon"
collapseToZero={isTauri}
- data-windows-glass-frame={(pinned && usesWindowsTitlebar()) || undefined}
+ data-windows-glass-frame={(pinned && usesCustomTitlebar) || undefined}
variant="sidebar"
className={cn(
"font-heading group-data-[collapsible=icon]:[&_[data-sidebar=sidebar]]:bg-[var(--sidebar-surface)]",
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index ee5ac46a0d5..992e905e53b 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -6118,11 +6118,13 @@ const Composer: FC<{
</>
);
+ // The blur is only on while the overlay shows: WebKitGTK stops drawing the composer's own Glass
+ // blur while a hidden (opacity 0) child still carries a backdrop-filter.
const dropOverlay = (
<div
className={cn(
- "aui-composer-drop-overlay pointer-events-none absolute inset-0 z-20 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-[inherit] bg-background/90 opacity-0 backdrop-blur-sm transition-opacity duration-150 group-data-[dragging=true]/dropzone:opacity-100 dark:bg-card/90",
- (pageDragging || nativeDragging) && "opacity-100",
+ "aui-composer-drop-overlay pointer-events-none absolute inset-0 z-20 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-[inherit] bg-background/90 opacity-0 transition-opacity duration-150 group-data-[dragging=true]/dropzone:opacity-100 group-data-[dragging=true]/dropzone:backdrop-blur-sm dark:bg-card/90",
+ (pageDragging || nativeDragging) && "opacity-100 backdrop-blur-sm",
)}
>
<HugeiconsIcon
diff --git a/studio/frontend/src/components/tauri/window-titlebar.tsx b/studio/frontend/src/components/tauri/window-titlebar.tsx
index 7a7ec387796..5edb196fd90 100644
--- a/studio/frontend/src/components/tauri/window-titlebar.tsx
+++ b/studio/frontend/src/components/tauri/window-titlebar.tsx
@@ -82,9 +82,6 @@ export function shouldUseCustomWindowTitlebar(): boolean {
return CUSTOM_TITLEBAR_PLATFORMS.some((token) => platform.includes(token));
}
-export function usesWindowsTitlebar(): boolean {
- return isTauri && /\bwin(?:32|64|dows)?\b/.test(getClientPlatform());
-}
export function shouldUseNativeMacWindowTitlebar(): boolean {
if (!isTauri) {
diff --git a/studio/frontend/src/features/browser/browser-panel.tsx b/studio/frontend/src/features/browser/browser-panel.tsx
index 99298bb5a20..406d5296642 100644
--- a/studio/frontend/src/features/browser/browser-panel.tsx
+++ b/studio/frontend/src/features/browser/browser-panel.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import { usesWindowsTitlebar } from "@/components/tauri/window-titlebar";
+import { shouldUseCustomWindowTitlebar } from "@/components/tauri/window-titlebar";
import { ATTACHMENT_PAGE_SCALES } from "@/components/assistant-ui/attachment-viewer-meta";
import { ScaleMenu } from "@/components/media-viewer";
import {
@@ -2537,7 +2537,7 @@ export const BrowserPanel = memo(function BrowserPanel({
ref={sectionRef}
data-slot="browser-panel"
data-browser-document={documentShown || undefined}
- data-windows-browser={!floating && usesWindowsTitlebar() ? (documentShown ? "document" : "web") : undefined}
+ data-windows-browser={!floating && shouldUseCustomWindowTitlebar() ? (documentShown ? "document" : "web") : undefined}
aria-label={t("browser.title")}
// The chat's find skips the browser's chrome; the page is searched as its own target.
{...{ [FIND_SKIP_ATTRIBUTE]: "" }}
diff --git a/studio/frontend/src/features/chat-background/material.ts b/studio/frontend/src/features/chat-background/material.ts
index 3bfa03e29d8..00dc87ad06c 100644
--- a/studio/frontend/src/features/chat-background/material.ts
+++ b/studio/frontend/src/features/chat-background/material.ts
@@ -180,9 +180,9 @@ const WEBKIT_LAYERS =
typeof navigator !== "undefined" &&
/AppleWebKit/.test(navigator.userAgent) &&
!/Chrom|Edg|Android/i.test(navigator.userAgent);
-// WebKitGTK (the Linux app) also runs every backdrop-filter again on each composite, on the CPU, so
-// there glass drops its live blur except the sidebar's (index.css, data-glass-cpu). macOS WebKit
-// composites backdrops on the GPU and keeps real frosted glass.
+// WebKitGTK (the Linux app) paints on the CPU, so two paint costs are swapped out there (index.css,
+// data-glass-cpu): Frosted's grain tile and Liquid 3D's wide blurred glows. Its blur, fills and
+// strength are Glass's own, as on every other platform.
const WEBKIT_GTK =
typeof navigator !== "undefined" &&
isWebKitGTK(navigator.platform, navigator.userAgent);
@@ -247,7 +247,7 @@ export function WindowMaterialMount({ route }: { route?: BackgroundRoute }) {
}, [material, here]);
useEffect(() => {
// Only where compositing is in software, which recomputes every blur on every frame; with a GPU glass
- // keeps its blur while things move. WebKitGTK already has no live blur outside the sidebar (data-glass-cpu).
+ // keeps its blur while things move. The Linux app (WebKitGTK) included, when it renders without a GPU.
// Transparent has no blur, except on Windows Desktop, where its menus and dialogs carry one.
const root = document.documentElement;
const clearBlur =
@@ -255,7 +255,6 @@ export function WindowMaterialMount({ route }: { route?: BackgroundRoute }) {
root.classList.contains("tauri") &&
root.classList.contains("client-windows");
const on =
- !WEBKIT_GTK &&
material !== "solid" &&
(material !== "transparent" || clearBlur) &&
here &&
diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsx
index 50b0e52cc55..33ad695e092 100644
--- a/studio/frontend/src/features/chat/shared-composer.tsx
+++ b/studio/frontend/src/features/chat/shared-composer.tsx
@@ -2773,9 +2773,9 @@ export function SharedComposer({
void addFiles(e.dataTransfer.files);
}}
>
- {/* Gemini-style drop affordance, mirrored from the single composer. */}
+ {/* Gemini-style drop affordance, mirrored from the single composer; blurred only while shown (see thread.tsx). */}
<div
- className={`pointer-events-none absolute inset-0 z-20 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-[inherit] bg-background/90 backdrop-blur-sm transition-opacity duration-150 dark:bg-card/90 ${dragging ? "opacity-100" : "opacity-0"}`}
+ className={`pointer-events-none absolute inset-0 z-20 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-[inherit] bg-background/90 transition-opacity duration-150 dark:bg-card/90 ${dragging ? "opacity-100 backdrop-blur-sm" : "opacity-0"}`}
>
<HugeiconsIcon
icon={Attachment01Icon}
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 6cb7b875897..1c34e9efdde 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -6268,15 +6268,20 @@ html[data-find-bar-open] [data-sonner-toaster][data-y-position="top"] {
.dark .unsloth-files-panel-count {
background-color: color-mix(in oklab, var(--foreground) 10%, transparent);
}
+/* The drop overlays blur only while they show: WebKitGTK stops drawing a Glass surface's own blur while
+ a hidden (opacity 0) child of it still carries a backdrop-filter. */
.unsloth-files-panel-drop-overlay {
- @apply pointer-events-none absolute inset-0 z-20 flex items-center justify-center gap-2 rounded-[inherit] bg-background/90 text-sm font-medium text-primary opacity-0 backdrop-blur-sm transition-opacity duration-150 dark:bg-card/90;
+ @apply pointer-events-none absolute inset-0 z-20 flex items-center justify-center gap-2 rounded-[inherit] bg-background/90 text-sm font-medium text-primary opacity-0 transition-opacity duration-150 dark:bg-card/90;
}
.unsloth-files-panel[data-dragging="true"] .unsloth-files-panel-drop-overlay {
+ @apply backdrop-blur-sm;
opacity: 1;
}
/* One target at a time: over the panel, the composer's "Drop files here" would mislead. */
.aui-composer-root:has(.unsloth-files-panel[data-dragging="true"]) .aui-composer-drop-overlay {
opacity: 0 !important;
+ -webkit-backdrop-filter: none !important;
+ backdrop-filter: none !important;
}
.unsloth-files-panel-row {
@apply relative flex items-center;
@@ -7762,82 +7767,16 @@ html[data-glass="liquid-3d"][data-glass-menus][data-glass-motion].dark :is([data
--glass-lift: 0 0 8px 0 color-mix(in srgb, var(--background) 75%, transparent);
}
-/* WebKitGTK only (data-glass-cpu, set by WindowMaterialMount): it runs every backdrop-filter again on
- each composite, on the CPU, so a caret blink, a scrolled line or a menu frame re-blurred every glass
- surface on screen and glass typing, scrolling and menus cost far more than solid. No Glass surface keeps
- a live blur there, the sidebar included (its blur alone was most of a Glass scroll frame on a long chat):
- the panes carry a denser fill, and dialogs and menus an opaque one, so nothing behind them ghosts through.
- Blurs a component sets itself (Tailwind backdrop-* classes) are not Glass's and stay as they are with Glass off. */
-html[data-glass][data-glass-cpu] *:not([class*="backdrop-"]),
-html[data-glass][data-glass-cpu] *:not([data-windows-glass-frame], [class*="backdrop-"])::before,
-html[data-glass][data-glass-cpu] *:not([class*="backdrop-"])::after {
- -webkit-backdrop-filter: none !important;
- backdrop-filter: none !important;
-}
+/* WebKitGTK only (data-glass-cpu, set by WindowMaterialMount): its CPU painter redraws these on every
+ paint of the surface. Glass keeps its live blur, its fills and its strength there; only the two paint
+ costs below are swapped out. */
/* Frosted's grain is an SVG feTurbulence tile that WebKitGTK renders again on every paint of the surface
- (the composer repaints with each scrolled frame): about as much as the rest of a frame. Plain there. */
-html[data-glass="frosted"][data-glass-cpu] :is([data-slot="sidebar-inner"], .unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) {
+ (the composer repaints with each scrolled frame): about as much as the rest of a frame. Plain there,
+ on every surface that takes the grain, the pinned sidebar's shared title bar frame included. */
+html[data-glass="frosted"][data-glass-cpu] :is([data-slot="sidebar-inner"], .unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer),
+html[data-glass="frosted"][data-glass-cpu] [data-windows-glass-frame]::before {
background-image: none !important;
}
-/* The sidebar without its blur: the fill reaches the 96% cap, so the wallpaper does not show through sharp. */
-html[data-glass][data-glass-cpu] [data-slot="sidebar-inner"] {
- --glass-pane-floor: 110%;
-}
-html[data-glass][data-glass-cpu] {
- --glass-composer-floor: 110%;
- --glass-menu-floor: 110%;
- --glass-opacity-set: var(--glass-opacity, 1);
-}
-/* A low strength would otherwise read as clear plastic with no blur behind it; above the floor the slider still works. */
-html[data-glass][data-glass-cpu] body {
- --glass-opacity: max(.9, var(--glass-opacity-set));
- --glass-menu-fill: var(--popover);
-}
-html[data-glass][data-glass-menus][data-glass-cpu] [data-slot="dialog-content"] {
- background-color: var(--glass-page-bg);
-}
-/* Sonner's rule above sets its blur !important at a higher specificity than the universal one. */
-html[data-glass][data-glass-menus][data-glass-cpu] :is([data-sonner-toast][data-styled="true"], .toast-surface) {
- background-color: var(--popover) !important;
- -webkit-backdrop-filter: none !important;
- backdrop-filter: none !important;
-}
-/* Every surface that loses its blur above takes an opaque fill, or one dense enough that nothing behind it
- reads through: text scrolling under a header or a menu over a page would otherwise overlap sharply. */
-/* Plain light glass (no image) gives menus their own thin fill; on this path they keep the opaque one. */
-html[data-glass][data-glass-menus][data-glass-plain][data-glass-cpu]:not(.dark) :is([data-slot$="menu-content"], [data-slot$="menu-sub-content"], [data-slot="select-content"], [data-slot="combobox-content"], [data-slot="popover-content"], [data-slot="hover-card-content"], .menu-soft-surface, .menu-soft-surface-up, .dropdown-surface) {
- --glass-menu-fill: var(--glass-page-popover);
-}
-html[data-glass][data-glass-menus][data-glass-cpu] :is(.tooltip-compact, .tooltip-rich) {
- background-color: var(--tooltip-bg);
-}
-/* Stuck page headers (the Library tab row): content scrolls under them. At rest they stay clear. */
-html[data-glass][data-glass-cpu][data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .sticky:not(.library-header-row:not([data-stuck]), [data-page-model-header]) {
- background-color: var(--glass-page-bg);
-}
-/* Sticky bars inside panels, dialogs, sheets and menus. */
-html[data-glass][data-glass-cpu] :is([data-slot="chat-settings-panel"], [data-slot="dialog-content"], [data-slot="sheet-content"]) .sticky {
- background-color: var(--glass-page-bg);
-}
-html[data-glass][data-glass-cpu] :is([data-slot$="popover-content"], [data-slot$="menu-content"]) .sticky {
- background-color: var(--glass-page-popover);
-}
-/* Side panes over the wallpaper: the chat settings panel and the browser panel. At the sidebar's 96% cap,
- never opaque: the browser's tab strip is its own layer (z-40), and WebKitGTK paints an opaque one black
- when the pane opens, until something restyles it. */
-html[data-glass][data-glass-cpu][data-chat-wallpaper-workspace-ready] [data-slot="chat-settings-panel"],
-html[data-glass][data-glass-cpu][data-chat-wallpaper-workspace-ready]:not([data-browser-overlay-open]) [data-slot="browser-panel"] > .browser-chrome,
-html[data-glass][data-glass-cpu][data-chat-wallpaper-workspace-ready]:not([data-browser-overlay-open]) [data-slot="browser-panel"]:not([data-browser-document]) > .browser-panel-body {
- background-color: color-mix(in srgb, var(--glass-panel-fill) 96%, transparent);
-}
-/* Light page controls and cards are thin white washes over the image. */
-html[data-glass][data-glass-cpu]:not(.dark) {
- --glass-control: rgb(255 255 255 / .8);
-}
-html[data-glass][data-glass-cpu]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"],
-html[data-glass][data-glass-cpu]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .api-monitor-page {
- --page-glass-card-fill: rgb(255 255 255 / .85);
-}
/* Liquid 3D's wide inner glows and lifts are blurred box-shadows, which WebKitGTK re-rasterises on the
CPU whenever the surface repaints; there the glows are drawn as gradients and the lifts get a smaller blur. */
html[data-glass="liquid-3d"][data-glass-cpu] {
diff --git a/studio/frontend/tests/browser-tab-strip-stacking.test.ts b/studio/frontend/tests/browser-tab-strip-stacking.test.ts
index dfa0db13ad1..e29cfca5297 100644
--- a/studio/frontend/tests/browser-tab-strip-stacking.test.ts
+++ b/studio/frontend/tests/browser-tab-strip-stacking.test.ts
@@ -45,5 +45,5 @@ test("a native page's hole drops backdrop filters and masks the wallpaper layer"
test("the docked Windows glass surface never clips the floating browser's rounded border", () => {
const panel = readSrc("features/browser/browser-panel.tsx");
- assert.match(panel, /data-windows-browser=\{!floating && usesWindowsTitlebar\(\)/);
+ assert.match(panel, /data-windows-browser=\{!floating && shouldUseCustomWindowTitlebar\(\)/);
});
diff --git a/studio/frontend/tests/glass-hidden-overlay-blur.test.ts b/studio/frontend/tests/glass-hidden-overlay-blur.test.ts
new file mode 100644
index 00000000000..ce36c51048a
--- /dev/null
+++ b/studio/frontend/tests/glass-hidden-overlay-blur.test.ts
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// WebKitGTK stops drawing a Glass surface's own backdrop blur while a hidden (opacity 0) child of it
+// still carries a backdrop-filter. The composer's and files panel's drop overlays sit inside those
+// surfaces at opacity 0 until a file is dragged, so they may only blur while they show.
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { readSrc } from "./helpers/kit.ts";
+
+const THREAD = readSrc("components/assistant-ui/thread.tsx");
+const SHARED = readSrc("features/chat/shared-composer.tsx");
+const CSS = readSrc("index.css");
+
+test("the composer's drop overlay blurs only in its shown states", () => {
+ const base = /"(aui-composer-drop-overlay [^"]*)"/.exec(THREAD)?.[1] ?? "";
+ assert.ok(base.includes("opacity-0"), "hidden at rest");
+ const unconditional = base.split(/\s+/).filter((name) => /^backdrop-/.test(name));
+ assert.deepEqual(unconditional, [], "no blur class without a state prefix");
+ assert.ok(base.includes("group-data-[dragging=true]/dropzone:opacity-100"));
+ assert.ok(base.includes("group-data-[dragging=true]/dropzone:backdrop-blur-sm"));
+ assert.match(THREAD, /\(pageDragging \|\| nativeDragging\) && "opacity-100 backdrop-blur-sm"/);
+});
+
+test("the shared composer's drop overlay blurs only while dragging", () => {
+ assert.match(SHARED, /\$\{dragging \? "opacity-100 backdrop-blur-sm" : "opacity-0"\}/);
+ const overlay = /className=\{`(pointer-events-none absolute inset-0 z-20[^`]*)`\}/.exec(SHARED)?.[1] ?? "";
+ assert.ok(overlay, "overlay found");
+ assert.doesNotMatch(overlay.replace(/\$\{[^}]*\}/g, ""), /backdrop-/, "no blur outside the dragging branch");
+});
+
+test("the files panel's drop overlay blurs only while dragging, and a suppressed composer overlay drops its blur", () => {
+ const rule = (start: string) => {
+ const at = CSS.indexOf(start);
+ assert.ok(at > 0, start);
+ return CSS.slice(at, CSS.indexOf("}", at) + 1);
+ };
+ const rest = rule(".unsloth-files-panel-drop-overlay {");
+ assert.match(rest, /opacity-0/);
+ assert.doesNotMatch(rest, /backdrop-/);
+ const shown = rule('.unsloth-files-panel[data-dragging="true"] .unsloth-files-panel-drop-overlay {');
+ assert.match(shown, /@apply backdrop-blur-sm;/);
+ assert.match(shown, /opacity: 1;/);
+ const suppressed = rule('.aui-composer-root:has(.unsloth-files-panel[data-dragging="true"]) .aui-composer-drop-overlay {');
+ assert.match(suppressed, /opacity: 0 !important;/);
+ assert.match(suppressed, /\n\s*backdrop-filter: none !important;/);
+});
diff --git a/studio/frontend/tests/glass-motion.test.ts b/studio/frontend/tests/glass-motion.test.ts
index ed00f49caa6..8d8e235da67 100644
--- a/studio/frontend/tests/glass-motion.test.ts
+++ b/studio/frontend/tests/glass-motion.test.ts
@@ -313,11 +313,11 @@ test("a script-driven animation holds its surface through the running controller
// --- wiring and CSS contract -----------------------------------------------------------------------
-test("glass motion runs only with software compositing, where glass blurs: never solid, out of scope or WebKitGTK, and Transparent only on Windows Desktop", () => {
+test("glass motion runs only with software compositing, where glass blurs: never solid or out of scope, and Transparent only on Windows Desktop", () => {
assert.match(MATERIAL, /import \{ startGlassMotion \} from "\.\/glass-motion";/);
assert.match(
MATERIAL,
- /const clearBlur =\s*material === "transparent" &&\s*root\.classList\.contains\("tauri"\) &&\s*root\.classList\.contains\("client-windows"\);\s*const on =\s*!WEBKIT_GTK &&\s*material !== "solid" &&\s*\(material !== "transparent" \|\| clearBlur\) &&\s*here &&\s*softwareCompositing\(\);\s*document\.documentElement\.toggleAttribute\("data-glass-motion", on\);\s*return on \? startGlassMotion\(\)\.stop : undefined;\s*\}, \[material, here\]\);/,
+ /const clearBlur =\s*material === "transparent" &&\s*root\.classList\.contains\("tauri"\) &&\s*root\.classList\.contains\("client-windows"\);\s*const on =\s*material !== "solid" &&\s*\(material !== "transparent" \|\| clearBlur\) &&\s*here &&\s*softwareCompositing\(\);\s*document\.documentElement\.toggleAttribute\("data-glass-motion", on\);\s*return on \? startGlassMotion\(\)\.stop : undefined;\s*\}, \[material, here\]\);/,
);
});
diff --git a/studio/frontend/tests/glass-webkit-blur.test.ts b/studio/frontend/tests/glass-webkit-blur.test.ts
index a04a4397b7e..618b821a0a4 100644
--- a/studio/frontend/tests/glass-webkit-blur.test.ts
+++ b/studio/frontend/tests/glass-webkit-blur.test.ts
@@ -10,7 +10,6 @@ import { readSrc } from "./helpers/kit.ts";
const CSS = readSrc("index.css");
const MATERIAL = readSrc("features/chat-background/material.ts");
-const GATE = "html[data-glass][data-glass-cpu]";
function ruleAt(selectorStart: string): string {
const at = CSS.indexOf(selectorStart);
@@ -18,12 +17,25 @@ function ruleAt(selectorStart: string): string {
return CSS.slice(at, CSS.indexOf("}", at) + 1);
}
+/** Every rule keyed on the WebKitGTK flag, with the properties it sets. */
+function cpuRules(): { selector: string; props: string[]; topLevel: boolean }[] {
+ const found: { selector: string; props: string[]; topLevel: boolean }[] = [];
+ postcss.parse(CSS).walkRules((rule) => {
+ if (!rule.selector.includes("[data-glass-cpu]")) return;
+ const props: string[] = [];
+ rule.walkDecls((decl) => {
+ props.push(decl.prop);
+ });
+ found.push({ selector: rule.selector, props, topLevel: rule.parent?.type === "root" });
+ });
+ return found;
+}
+
test("the CPU glass flag is WebKitGTK only and follows the layer flag's material and scope gate", () => {
assert.match(MATERIAL, /import \{ isWebKitGTK \} from "@\/components\/ui\/theme-view-transition";/);
assert.match(
MATERIAL,
/const WEBKIT_GTK =\s*typeof navigator !== "undefined" &&\s*isWebKitGTK\(navigator\.platform, navigator\.userAgent\);/,
- "macOS WebKit composites backdrops on the GPU and keeps real glass",
);
assert.match(
MATERIAL,
@@ -32,41 +44,42 @@ test("the CPU glass flag is WebKitGTK only and follows the layer flag's material
);
});
-test("WebKitGTK glass drops every live Glass blur, the sidebar's included", () => {
- const rule = ruleAt(`${GATE} *:not([class*="backdrop-"]),`);
- assert.doesNotMatch(rule, /sidebar-inner/, "the sidebar's blur re-ran on every composite while the thread scrolled");
- assert.ok(
- rule.includes(`${GATE} *:not([data-windows-glass-frame], [class*="backdrop-"])::before,`),
- "the framed sidebar's glass keeps its blur",
- );
- assert.ok(rule.includes(`${GATE} *:not([class*="backdrop-"])::after {`), "a component's own backdrop-* blur is not Glass's");
- assert.match(rule, /-webkit-backdrop-filter: none !important;/);
- assert.match(rule, /\n\s*backdrop-filter: none !important;/);
- assert.doesNotMatch(rule, /:has\(/, "a :has() here would re-match on every DOM change");
- const toast = ruleAt(`html[data-glass][data-glass-menus][data-glass-cpu] :is([data-sonner-toast][data-styled="true"], .toast-surface) {`);
- assert.match(toast, /\n\s*backdrop-filter: none !important;/, "Sonner's own !important blur outranks the universal rule");
-});
-
-test("no later important blur can win the cascade back", () => {
- const at = CSS.indexOf(`${GATE} *:not(`);
- assert.doesNotMatch(CSS.slice(at), /backdrop-filter:\s*blur[^;]*!important/);
+test("WebKitGTK glass keeps its live blur, its fills and its strength", () => {
+ const rules = cpuRules();
+ // The flag only swaps paint costs: nothing under it may touch a blur, a fill or the strength variables.
+ const allowed = new Set(["background-image", "--glass-rim", "--glass-glow", "--glass-lift", "--popup-shadow"]);
+ for (const rule of rules) {
+ for (const prop of rule.props) assert.ok(allowed.has(prop), `${rule.selector} sets ${prop}`);
+ }
+ const at = CSS.indexOf("[data-glass-cpu]");
+ assert.doesNotMatch(CSS.slice(at), /\[data-glass-cpu\][^{]*\{[^}]*backdrop-filter/, "no blur is turned off on that path");
+ assert.doesNotMatch(CSS, /--glass-opacity-set/, "the strength slider is not floored");
+ assert.doesNotMatch(CSS, /--glass-(?:pane|composer|menu)-floor: 110%/, "no fill is pinned at its cap");
});
-test("dialogs and menus go opaque on that path, so nothing behind them ghosts through", () => {
- assert.match(ruleAt(`html[data-glass][data-glass-menus][data-glass-cpu] [data-slot="dialog-content"] {`), /background-color: var\(--glass-page-bg\);/);
- const body = ruleAt(`${GATE} body {`);
- assert.match(body, /--glass-menu-fill: var\(--popover\);/, "resolved on body, where --popover is still opaque");
- assert.match(body, /--glass-opacity: max\(\.9, var\(--glass-opacity-set\)\);/);
- const floors = ruleAt(`${GATE} {`);
- assert.match(floors, /--glass-composer-floor: 110%;/, "over 100%, so the default strength reaches the 96% cap");
- assert.doesNotMatch(floors, /--glass-sidebar-floor/, "the page floors stay as they are");
- assert.match(ruleAt(`${GATE} [data-slot="sidebar-inner"] {`), /--glass-pane-floor: 110%;/, "the unblurred sidebar reaches the 96% fill cap");
+test("WebKitGTK Frosted drops only its grain tile", () => {
+ const rule = ruleAt(
+ 'html[data-glass="frosted"][data-glass-cpu] :is([data-slot="sidebar-inner"], .unsloth-composer-surface',
+ );
assert.match(
- ruleAt('html[data-glass="frosted"][data-glass-cpu] :is([data-slot="sidebar-inner"], .unsloth-composer-surface'),
+ rule,
/background-image: none !important;/,
"the Frosted grain (an SVG turbulence tile) is rendered again on every paint there",
);
- assert.match(floors, /--glass-opacity-set: var\(--glass-opacity, 1\);/);
+ assert.doesNotMatch(rule, /backdrop-filter|background-color/);
+ // Every surface the grain rule paints must be covered: the title bar frame is a pseudo-element the :is() list cannot hold.
+ const grain = postcss.parse(CSS).nodes.find(
+ (node): node is postcss.Rule => node.type === "rule" && node.toString().includes("feTurbulence"),
+ );
+ assert.ok(grain, "the Frosted grain rule exists");
+ for (const selector of grain.selectors) {
+ const target = selector.includes("[data-windows-glass-frame]::before")
+ ? "[data-windows-glass-frame]::before"
+ : /(\[data-slot="sidebar-inner"\]|\.wallpaper-preview-composer|\.unsloth-composer-surface)/.exec(selector)?.[1];
+ assert.ok(target, `known grain surface: ${selector}`);
+ assert.ok(rule.includes(target), `the WebKitGTK rule clears the grain on ${target}`);
+ }
+ assert.ok(grain.selectors.some((selector) => selector.includes(".unsloth-files-panel")) && rule.includes(".unsloth-files-panel"));
});
test("WebKitGTK liquid 3D draws its wide inner glows as gradients, not blurred shadows", () => {
@@ -128,61 +141,7 @@ test("Firefox drops the sheen too, with a selector as specific as the dark sheen
});
test("the WebKitGTK rules are unlayered top-level rules", () => {
- const found: string[] = [];
- postcss.parse(CSS).walkRules((rule) => {
- if (!rule.selector.includes("[data-glass-cpu]")) return;
- found.push(rule.selector);
- assert.equal(rule.parent?.type, "root", `${rule.selector} must not sit inside @layer or another block`);
- });
- assert.ok(found.length >= 9, "blur, fill, dialog, toast and glow rules all present");
-});
-
-// Every surface the CPU path strips of its blur, and what keeps text behind it from reading through.
-test("no surface that loses its blur is left with a see-through fill", () => {
- const plainMenus = ruleAt('html[data-glass][data-glass-menus][data-glass-plain][data-glass-cpu]:not(.dark) :is(');
- assert.match(plainMenus, /--glass-menu-fill: var\(--glass-page-popover\);/, "plain light menus set their own thin fill on the element");
- assert.match(
- ruleAt("html[data-glass][data-glass-menus][data-glass-cpu] :is(.tooltip-compact, .tooltip-rich) {"),
- /background-color: var\(--tooltip-bg\);/,
- );
- const pageSticky = ruleAt(
- 'html[data-glass][data-glass-cpu][data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .sticky:not(',
- );
- assert.match(pageSticky, /:not\(\.library-header-row:not\(\[data-stuck\]\), \[data-page-model-header\]\)/, "headers at rest stay clear");
- assert.match(pageSticky, /background-color: var\(--glass-page-bg\);/);
- assert.match(
- ruleAt('html[data-glass][data-glass-cpu] :is([data-slot="chat-settings-panel"], [data-slot="dialog-content"], [data-slot="sheet-content"]) .sticky {'),
- /background-color: var\(--glass-page-bg\);/,
- );
- assert.match(
- ruleAt('html[data-glass][data-glass-cpu] :is([data-slot$="popover-content"], [data-slot$="menu-content"]) .sticky {'),
- /background-color: var\(--glass-page-popover\);/,
- );
- const panes = ruleAt('html[data-glass][data-glass-cpu][data-chat-wallpaper-workspace-ready] [data-slot="chat-settings-panel"],');
- assert.ok(panes.includes("> .browser-chrome,") && panes.includes("> .browser-panel-body {"));
- assert.match(
- panes,
- /background-color: color-mix\(in srgb, var\(--glass-panel-fill\) 96%, transparent\);/,
- "dense, but not opaque: WebKitGTK paints the browser's opaque z-40 tab strip black when the pane opens",
- );
- assert.match(ruleAt("html[data-glass][data-glass-cpu]:not(.dark) {"), /--glass-control: rgb\(255 255 255 \/ \.8\);/);
- assert.match(
- ruleAt('html[data-glass][data-glass-cpu]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"],'),
- /--page-glass-card-fill: rgb\(255 255 255 \/ \.85\);/,
- );
-});
-
-test("each CPU-path fill outranks the glass rule it replaces", () => {
- // Same selector plus [data-glass-cpu]: one more attribute always wins, whatever the order.
- const pairs: [string, string][] = [
- ['html[data-glass][data-glass-menus][data-glass-plain]:not(.dark) :is(', 'html[data-glass][data-glass-menus][data-glass-plain][data-glass-cpu]:not(.dark) :is('],
- ["html[data-glass][data-glass-menus] :is(.tooltip-compact, .tooltip-rich) {", "html[data-glass][data-glass-menus][data-glass-cpu] :is(.tooltip-compact, .tooltip-rich) {"],
- ['html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .sticky {',
- 'html[data-glass][data-glass-cpu][data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .sticky:not('],
- ["html[data-glass]:not(.dark) {", "html[data-glass][data-glass-cpu]:not(.dark) {"],
- ];
- for (const [base, cpu] of pairs) {
- assert.ok(CSS.includes(base), `base rule still exists: ${base}`);
- assert.ok(CSS.includes(cpu), `cpu override exists: ${cpu}`);
- }
+ const rules = cpuRules();
+ for (const rule of rules) assert.ok(rule.topLevel, `${rule.selector} must not sit inside @layer or another block`);
+ assert.equal(rules.length, 5, "the Frosted grain rule and the four Liquid 3D glow rules");
});
diff --git a/studio/frontend/tests/has-host-flags.test.ts b/studio/frontend/tests/has-host-flags.test.ts
index 8d5d35aee35..990cff237db 100644
--- a/studio/frontend/tests/has-host-flags.test.ts
+++ b/studio/frontend/tests/has-host-flags.test.ts
@@ -72,10 +72,11 @@ test("the Windows page blur learns about the sidebar frame from the root, not a
root,
/data-slot="page-wallpaper-blur"\s+\/\/[^\n]*\n\s+data-sidebar-frame=\{\(pinned && !mobileShell\) \|\| undefined\}/,
);
- // The flag mirrors AppSidebar's own condition (windowsWallpaperPage already implies the Windows titlebar).
+ // The flag mirrors AppSidebar's own condition (windowsWallpaperPage already implies the in-page titlebar,
+ // which Windows and Linux share).
assert.match(
readSrc("components/app-sidebar.tsx"),
- /data-windows-glass-frame=\{\(pinned && usesWindowsTitlebar\(\)\) \|\| undefined\}/,
+ /data-windows-glass-frame=\{\(pinned && usesCustomTitlebar\) \|\| undefined\}/,
);
});