Skip to content

linux: the desktop's blur behind the window, behind FIZZY_BLUR_BEHIND=1 - #237

Merged
foxnne merged 1 commit into
mainfrom
linux/blur-behind
Oct 8, 2026
Merged

foxnne merged 1 commit into
mainfrom
linux/blur-behind

Conversation

@foxnne

@foxnne foxnne commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #226 (docs/NATIVE_WINDOWS_PLAN.md, "Linux — the compositor's blur"); step 4 of docs/WINDOWS_LINUX_GLASS_PLAN.md (#236).

What changes

With FIZZY_BLUR_BEHIND=1, on a Wayland compositor that blurs, the window's base goes translucent at the window opacity over the desktop's blur, as it already does over macOS's vibrancy and Windows' Acrylic. Elsewhere, and without the switch, nothing changes: the window stays opaque.

  • platform/wayland_blur.zig: binds ext-background-effect-v1 (GNOME 51, Plasma 6.7, niri) or KDE's org_kde_kwin_blur.
    • It uses SDL's own libwayland-client (RTLD_NOLOAD), with both protocols declared by hand, on an event queue of its own.
    • The region is sent only when it changes, and it lands with the commit the frame's present makes.
    • "No blur" is an empty region on the ext protocol, and the blur object unset and released on KDE's protocol (KWin blurs the whole window behind an empty one).
    • The first probe logs what it found.
  • platform/blur_region.zig (std-only, unit tested): steps the rounded frame into rectangles.
  • linux_titlebar.blurBehind and Editor.tick: the blur covers the frame inside the shadow's margin while the window is translucent, and is square when maximized.

Off by default until someone sees it on a desktop that blurs.

SDK impact

  • None

Verified

  • Linux, Ubuntu 26.04 / GNOME 50 (aarch64 UTM VM, native Wayland, FIZZY_BLUR_BEHIND=1 WAYLAND_DEBUG=client). GNOME 50 has neither protocol, so this covers the "absent" path only:
    • one get_registry on fizzy's own unnamed queue;
    • the log line ext-background-effect-v1 absent, org_kde_kwin_blur absent;
    • no wl_display.error;
    • fizzy alive after 12 s, window opaque.
  • Protocol details:
    • opcodes checked against wayland.app (ext-background-effect-v1) and plasma-wayland-protocols' blur.xml;
    • KWin's empty-region-means-whole-window rule read in src/plugins/blur/blur.cpp on Plasma/6.6. Master only takes a non-empty region.
  • A stub compositor speaking both protocols, in the cloud session that wrote this: the region applied on commit, unchanged frames sent nothing, cleared when opaque, KDE's unset, nothing asked when capabilities = 0.
  • fizzy-blur-region-tests (5 tests).
  • Gates: zig build, test, test-integration, check-web, test-sdk-version, and the Windows and Linux cross-builds.
  • Not seen where the blur would actually show: GNOME 51, Plasma 6.7+, or Plasma ≤6.6 (KDE's protocol and the "off" path). Please try one of those before this goes default-on:
    • the blur sits inside the frame, not in the shadow margin;
    • the corners line up;
    • maximized is square and full;
    • opacity 1 gives no blur.
  • macOS / Windows / Web: no change there (the code is comptime-gated to Linux; it builds on all of them).

Relies on the envSwitch fix (#235, merged): before it, FIZZY_BLUR_BEHIND read as FIZZY_POPOUT.

Follow-ups

  • Default-on once seen on GNOME 51 or Plasma.
  • Wayland popups (menus and dialogs as xdg_popups) are the other half of step 4, not built.

🤖 Generated with Claude Code

Base automatically changed from docs/windows-linux-glass to main October 8, 2026 15:08
@foxnne
foxnne force-pushed the linux/blur-behind branch from 94c817f to 820c53e Compare October 8, 2026 16:03
On Wayland the window asks for a blur behind its frame through ext-background-effect-v1, the
protocol GNOME (Mutter 51) and KDE (Plasma 6.7) now share, or KDE's older org_kde_kwin_blur.
Where the compositor blurs, the window's base is translucent over it at the window opacity, as it
is over macOS's vibrancy and Windows' Acrylic (`Editor.windowBase`,
`LiquidField.publishOpaqueWindow`). Off unless `FIZZY_BLUR_BEHIND=1` until it has been seen on a
desktop that blurs. Step 4 of docs/WINDOWS_LINUX_GLASS_PLAN.md.

- `platform/wayland_blur.zig`: SDL's own libwayland-client (`RTLD_NOLOAD`), the two protocols
  declared by hand and marshalled from argument arrays, on an event queue of its own so nothing
  here dispatches SDL's events. The region is surface state, sent only when it changes and taken
  with the commit the frame's present makes, so a resize changes the blur and the picture together.
  "None" is an empty region, not a null one, which would hand the surface back to the compositor's
  default. On KDE's protocol, where KWin (through Plasma 6.6) blurs the whole window behind a blur
  object with an empty region, "none" is the object unset and released. Where the compositor
  reports no blur, nothing is asked. The first probe logs what it found.
- `platform/blur_region.zig` (std-only, `fizzy-blur-region-tests`): the frame's rounded corners
  stepped into rows, since the protocols take whole rectangles.
- `linux_titlebar.blurBehind`: the frame inside the shadow's margin (`frameInsets`); the Editor
  asks for it while the window is translucent, square when maximized.

Checked: the region tests; native, Linux, Windows and web builds and the test gates; the
protocols' opcodes against wayland.app and plasma-wayland-protocols; KWin's empty-region rule in
its Plasma/6.6 source; a stub compositor speaking both protocols (cloud session); and fizzy on
Ubuntu 26.04 / GNOME 50 (aarch64 VM, Wayland), which has neither protocol: one probe on fizzy's
own queue, `ext-background-effect-v1 absent, org_kde_kwin_blur absent` logged, no protocol error,
window opaque. Not seen on GNOME 51 or Plasma 6.7, where the blur would show. Needs the
`envSwitch` fix below it: before it, `FIZZY_BLUR_BEHIND` read as `FIZZY_POPOUT`.

wayland-protocols 1.45 numbered the blur capability 0; later releases made it the bit 1, which
this follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@foxnne
foxnne force-pushed the linux/blur-behind branch from 820c53e to f5ccde2 Compare October 8, 2026 18:01
@foxnne
foxnne marked this pull request as ready for review October 8, 2026 18:02
@foxnne
foxnne merged commit affd984 into main Oct 8, 2026
11 checks passed
@foxnne
foxnne deleted the linux/blur-behind branch October 8, 2026 18:19
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.

2 participants