Galaxy Shell / docs
Docs / Interface and features

Glass from the alpha channel: shape in the buffer, effect in the compositor

openspec/specs/glass-alpha-mask/spec.md · Edit on GitHub ↗

On this page

Glass from the alpha channel: shape in the buffer, effect in the compositor

Purpose

Describes the glass effect whose shape comes from the alpha channel of the web buffer while the compositor computes the effect, and the trust boundaries that keep generated HTML and agent tools away from the glass pixels.

Requirements

Requirement: No new reach for generated HTML or agents

The glass-from-alpha design SHALL NOT give generated HTML or the agent tools any new reach; the glass pixels SHALL come from the trusted React in the ShadowRoot of the protected host, and generated HTML SHALL stay in opaque iframes inside a bubble. Full text: section Trust boundaries.

Scenario: No new reach for generated HTML or agents

  • WHEN generated HTML renders inside a bubble
  • THEN it stays in an opaque iframe and gets no glass pixels from the compositor

Requirement: Inline surface stays opaque

The .inline-surface SHALL paint --panel behind the frame, opaque in every profile color, so a generated document cannot produce glass pixels inside its own frame, except that agent profile CSS (replace_ui) that clears that surface only gives the document a tint of glass in its own frame. Full text: section Trust boundaries.

Scenario: Inline surface stays opaque

  • WHEN a generated document tries to produce glass pixels in its own frame
  • THEN the opaque --panel behind the frame prevents it

Scenario: Profile CSS clears the surface

  • WHEN the agent applies profile CSS with replace_ui that clears the surface
  • THEN the document gets only a tint of glass in its own frame

Requirement: Only the core sends the material

No tool, MCP entry, scheduled turn or plugin SHALL reach the band or the material; only the core SHALL send the material to the compositor, on the control connection. Full text: section Trust boundaries.

Scenario: Only the core sends the material

  • WHEN a plugin or a tool tries to set the glass material
  • THEN it cannot; only the core sends it on the control connection

Requirement: Web panel glass contract

Declared web panels SHALL keep their glass contract, which the core validates; the core itself declares the mask for two protected windows since phase 4, and a plugin SHALL NOT. Full text: section Trust boundaries.

Scenario: Web panel glass contract

  • WHEN a plugin declares the alpha mask for its window
  • THEN it cannot; only the core declares the mask for protected windows

Requirement: Fallback route keeps authentication

The route /api/desktop-chat-glass-regions SHALL keep its authentication while it exists as a fallback. Full text: section Trust boundaries.

Scenario: Fallback route keeps authentication

  • WHEN the fallback route receives a request without the host token
  • THEN the core refuses it as before

Requirement: Reported glass regions are bounded and validated

The protected host SHALL measure at most sixteen chat glass regions, and the core SHALL validate each rectangle with barGlassGeometry before it sends chat_glass_regions (or bar_glass) on the private control socket. Full text: section What exists today.

Scenario: Reported glass regions are bounded and validated

  • WHEN the host reports a rectangle to the core
  • THEN the core validates it with barGlassGeometry before sending the command

Status

Doc status: partly landed. Landed: phases 1 to 3 (dmabuf, mask, chat) and phase 4 for the notification popups and top bar (2026-11-06) and for the bottom bar of a theme with bottomIslands (Ninja, 2026-11-13). Not landed: phase 4 for other panels and the bottom bar pill of the other themes. Uncertain: live validation (see Not verified). The GLES glass and mask (glass.frag, glass_mask.frag, glass_mask_final.frag, the GLES GlassPipeline and GlassMaskPipeline) were removed on 2026-11-11 (step 7 of openspec/changes/archive/2026-11-10-gles-removal-plan/design.md): the glass is drawn only by the plain scene of the wgpu renderer (plain_glass.rs, glass.wgsl, glass_mask.wgsl, glass_mask_final.wgsl), glass.rs and glass_mask.rs keep the material, limits, geometry and budget math, and the fallback build (no wgpu renderer) draws no glass and reports chatGlassDrawn 0 and alphaGlass false. Where this doc says glass.frag it describes the shader that glass.wgsl ports; the egl_ tests it names went with the GLES scene and have native_wgpu_ mirrors. Checked 2026-11-11.

Introduction

Proposal of 2026-11-04, written at the request of the project owner after this observation: the glass and liquid glass effects are rendering effects that only the compositor can compute, because only the compositor holds the pixels of the wallpaper and of the application windows behind the web UI, and the split between the Electron host and Smithay adds a cost that the earlier assessments did not weigh. The owner then asked to commit this record and prepare the implementation ("Pode fazer commit e preparar a implementação"). The plan is at the end. Phases 1 to 3 are built: the mask is the path of the chat on a compositor with capabilities.alphaGlass (see phase 3). The sections up to "Trust boundaries" are the proposal as written, and "What exists today" is the state before it. React + Electron for the UI and Smithay as the only compositor stay as approved on 2026-10-27. See UI rendering and the compositor process for the earlier assessment and the visual effects proposal for the catalog of effects.

What exists today

The liquid glass is already implemented in the compositor. GlassPipeline in native/smithay/src/plain_glass.rs (the GLES one of glass.rs was removed on 2026-11-11) renders each region in two Gaussian passes over the scene behind the window (glass.wgsl, formerly glass.frag; up to 145 taps for the bar material), applies CSS saturate() in the final pass and, for the chat regions, the liquid material: a lens at the rim that reads the backdrop from further inside, and a lit rim from the gradient of a rounded-rectangle signed distance (card_distance). The result is drawn as a GlassElement under the web surface; the web surface draws its own translucent tint and text over it.

The shape of every region reaches the compositor through a side channel:

  1. The protected host of the chat measures the DOM (measureBarGlass, measureChatGlassRegions in vendor/interface/host/workspace-zoom.js): the first-run color card, the composer and the visible message bubbles, topmost first, clipped to the scroller, sixteen at most.
  2. createBarGlassReporter sends POST /api/desktop-chat-glass-regions with the host token when the measurement differs from what the compositor reports. The bar pill uses /api/desktop-bar-glass the same way.
  3. The core validates each rectangle with barGlassGeometry and sends the typed command chat_glass_regions (or bar_glass) on the private control socket.
  4. The compositor stores the rectangles in its state and chat_region_requests in scene.rs turns them into GlassRequests at the next frame.

The contract is in web panels and glass behind the desktop bar.

Trust boundaries

Nothing in this proposal gives generated HTML or the agent tools any new reach. The glass pixels come from the trusted React in the ShadowRoot of the protected host, which already draws the bubbles. Generated HTML stays in opaque iframes inside a bubble. .inline-surface paints --panel behind the frame, opaque in every profile color (web-shell/test/chat-alpha-rule.test.js, and in pixels web-shell/scripts/test-inline-alpha-browser.js), so a generated document cannot produce glass pixels inside its own frame, unless the agent applies profile CSS (replace_ui, which takes no user click) that clears that surface, which only gives a generated document a tint of glass in its own frame. No tool, MCP entry, scheduled turn or plugin reaches the band or the material: only the core sends the material to the compositor, on the control connection, as visual_style does today. Profile CSS can change the look of a glass surface, as it can today. The declared web panels keep their glass contract, which the core validates; since phase 4 the core itself declares the mask for two protected windows, and a plugin still cannot.

The route /api/desktop-chat-glass-regions keeps its authentication while it exists as a fallback.

The islands of Ninja (2026-11-13)

Under Ninja the top bar draws three islands with cut corners (clip-path), and the bar window is transparent between and outside them, so the alpha mask (threshold 0.18) gives glass only under the islands. The bottom bar of Ninja draws two islands too, and on a compositor with capabilities.bottomBarAlphaGlass the core declares the alpha glass on it (bottomIslands of core/ui-themes.js, also the bar of an extra output) and the host reports no pill: the compositor takes the mask of the bar and ignores a pill that a host reported. A bar takes no glass but the alpha one. The protected panels still declare a rectangle: their cut triangles show the blur without the veil until the mask covers them (a known limit, openspec/changes/theme-packs/design.md, section 6).

The mask of a small window at full resolution (2026-11-16)

The owner asked why the round end of a bar or of the dock showed badly rounded points. The shape was right (within 1 px of the circle), but the mask was at half resolution: its edge moved in steps of 2 px, and the lit line changed width and brightness along the curve, which read as facets.

A window whose shapes stay apart (no closing of the mask: the top bar, the dock and the islands of the bottom bar, the popups) now takes the mask at its own resolution (MaskPipeline::render_at with divisor 1, mask_glass of plain_glass.rs). The radii of the morphology and the two blurs keep their size in window pixels: twice the texels, and the sharp channel of mask-core.wgsl takes a binomial of 17 taps with the width of the five taps of the half resolution mask, so the thresholds of the rim in mask-glass-core.wgsl stay. The chat keeps the half resolution mask: its window is large and its mask runs on every streamed token. The GPU budget counts the larger mask as before.