Galaxy Shell / docs
Docs / Decisions and plans

Per-window effect slots (the part that did not land)

openspec/changes/window-effect-slots/design.md · Edit on GitHub ↗

This document records decisions, plans or evidence from a project stage. It does not imply that every item is implemented or validated in the current version.

On this page

Per-window effect slots (the part that did not land)

The landed part and the current rules are in openspec/specs/window-effect-slots/spec.md. The sections below are the original text of the doc, unchanged.

Design

Slots are effect targets

A slot is a new value of EffectTarget in the effects list of theme.json, allowed from manifest v4:

Target When it draws State rule of the CSS Source pixels
window-close after the actual destruction of an application toplevel .window:closing the last snapshot
window-open from the first committed buffer of a window .window:opening (the start, it transitions to .window) the live window
window-focus when a window gains the keyboard focus .window:focused the live window
window-border every frame, around a visible window .window only none, a pixel pass around the frame
window-rest every frame, on a visible window .window only the live window

A theme has at most one enabled pass per window slot. The slot applies to every application window that the compositor draws: shell windows, declared host windows, dialogs with a parent, the lock screen and recovery are excluded. Per-window or per-application selection is not part of this design (see Open questions).

Parameters and time

The CSS subset stays the same grammar with one state selector per target, as the table says. .window:overview stays only for overview-f9. The engine adds, for the window slots:

  • u_progress: 0 at the start of the event, 1 at its end, linear in time. The CSS transitions give the curves of the other parameters.
  • u_time and u_size as for F9; u_size is the size of the drawn rectangle.
  • The duration of an event is the longest delay + duration among the transitions of its state rule, and must be 80 to 1500 ms for window-open, window-close and window-focus. A rule without a transition is refused, so an event always ends.
  • The motion timing of the core (openspec/specs/motion-timing/spec.md, closeMs) sets only the built-in black-hole close, not a theme pass. A theme pass keeps the duration of its own CSS, as the workspace transition keeps the one of its package: its curves are authored for that duration, a theme pass draws in place and needs no wallpaper sink (whose lease gives closeMs its 1000 ms bound), and the reduced motion switch still skips it. A flight pins its duration when it starts, whichever source gave it.
  • Each event samples its own clock: two windows that close at different times draw at their own progress. This differs from F9, where one overview state drives every thumbnail.

Transform, opacity and 3D as data (phase 3)

Reserved parameters, accepted only on window slots, that the compositor reads in addition to handing them to the shader:

Parameter Meaning Range
--opacity multiplies the alpha of the pass 0 to 1
--scale scales the drawn rectangle about its center 0 to 4
--translate-x, --translate-y move the center, in fractions of the window size -4 to 4
--margin grows the drawn rectangle on every side, in fractions of its size, so a shader can draw a tilted or flipped window past its edge 0 to 0.5

Rotation and perspective stay in the shader: a package declares its own --tilt or --flip parameters and projects the texture in effect.wgsl, inside the margin. The compositor clips the result to the output, keeps input on the real window rectangle (or none, for a closing window) and never changes the geometry that the client sees.

Cost bounds

  • Close reuses the snapshot cache of the black hole: at most eight windows over every output, 1024x768 each, refreshed at most 10 times a second, kept only while a close slot is active and released at the end of the flight. No CPU readback, no file, no buffer kept after destruction.
  • One shader pass per window and event, with the existing limits of the CSS subset (16 parameters, 32 KiB per file, 512 KiB per theme). Texture bindings follow v2; phase 2 refuses them on window slots to keep the first step small.
  • window-border and window-rest run every frame and keep the GPU busy; they are the last phase, with a frame cap and a limit on the number of windows that the design must settle then.
  • A shader is trusted GPU code (WGSL since 2026-11-10; GLSL before). A size limit bounds no run time, as for every theme.

Reduced motion and skips

No event draws, and the window opens or closes at once, with reduced motion, while locked, in the overview, during a workspace transition, under the canvas lens and when the GPU pass fails. These are the skips of the black-hole close. A failure logs a bounded diagnostic and never delays the client.

Validation before swap and hot reload

check, select and reload compile the window passes with the other passes of the theme before the swap, as today. An event that already started keeps the program and the curves it started with (as a workspace transition does); a reload applies to the next event.

Authority

Nothing new chooses an effect. A theme is selected only by the paths of today: the protected settings, the user approval of a create_theme proposal (which generates only overview-f9 passes, in WGSL since 2026-11-10) and authenticated maintenance on the control socket. No agent tool, MCP entry, scheduled turn, generated HTML or plugin panel selects a slot, sends its parameters or reads window pixels.

This is still a new exposure. Before manifest v4 the only package GLSL that the compositor compiled was an overview-f9 pass, which no product view draws, so a theme folder could not reach the screen. A window-close pass runs its fragment shader on the screen at every application window close. The control socket takes select and reload from any process of the user, and the themes live in ~/.config/agent-native-os/themes, which execute_command can write as the user. So a package can reach the screen with no approval of the protected host; the approval covers only create_theme, which generates overview-f9 passes only (in WGSL). There is no draw-time GPU budget or watchdog: the limits bound the source, not the run time, of a shader drawn on a quad up to 8 times the width and height of the window (--margin and --scale), clipped to the output. A heavy shader can stall the frames for each flight, which lasts at most 1500 ms, or longer if the driver hangs. See openspec/specs/self-maintenance/spec.md, What a job can still reach.

Precedence with the built-in effects

While the black-hole wallpaper reports a live sink, the built-in black-hole close keeps the close, as today; a window-close slot draws otherwise. The built-in open reveal stays until a window-open slot lands and the owner decides which one is the default.

Renderers and capability

  • GLES drew the slots from effect.frag until 2026-11-11 (the GLES-to-Vulkan effects bridge that once drew them from WGSL was removed on 2026-11-10, step 2, the GLSL pass itself in step 7 and the GLES backends in step 8 of openspec/changes/archive/2026-11-10-gles-removal-plan/design.md). The snapshot always reports windowEffectSlots ["window-close"].
  • Under the wgpu renderer, the default renderer of a login since 2026-11-10 (openspec/changes/wgpu-renderer-plan/design.md, Phase 4, the switch), the plain scene draws window-close from effect.wgsl, the window-close WGSL ABI v1 of openspec/specs/themes/spec.md (Manifest v4, Window-close WGSL ABI v1): the F9 layout with the uniforms of the GLSL pass. The flights come from the same bookkeeping as the former GLES scene (black_hole::track and flights, the same snapshot cache, bounds and skips), are placed by the same CloseTransform, and each frame runs the pass as an offscreen pass of the renderer into a target of the drawn rectangle, which the frame draws at the place where the former GLES scene drew the flight (plain_close.rs). This changes what a package made on 2026-11-10 for GLES does at a login: an enabled window-close pass without effect.wgsl makes check, select and reload refuse the whole theme under wgpu (owner decision "Só WGSL"), with a message that names the package and the missing effect.wgsl; a disabled one without WGSL is skipped and the rest of the theme loads (openspec/specs/themes/spec.md, Manifest v4, Renderers). A failed draw closes that window with no flight and one warning. The later slots will need a WGSL port in the same step.
  • The compositor reports capabilities.windowEffectSlots, the list of the slots it draws (["window-close"]), and effects.windowEffects in the effects snapshot. An older compositor refuses a v4 manifest with a diagnostic and keeps the previous theme, so a newer theme never half-applies.

Phases

  1. This design. Landed as a proposal.
  2. window-close end to end: manifest v4, the :closing state, u_progress, the flight on the black-hole snapshot cache, the capability, tests. Landed on 2026-11-10; the contract is in openspec/specs/themes/spec.md, Manifest v4: window slots.
  3. The reserved parameters of transform, opacity and margin, and an example flip package. Landed on 2026-11-10 for window-close; the contract is in openspec/specs/themes/spec.md, Manifest v4: window slots, Reserved parameters.
  4. One built-in effect as a package on the slot (the black-hole close), with the built-in path kept as the default. Landed on 2026-11-10 as an offscreen proof: the reserved parameters --sink and --sink-curve (openspec/specs/themes/spec.md, Reserved parameters) and the package native/smithay/effects/black-hole-close. A unit test keeps its placement within 2 px of black_hole::placement (400x240 window, 1280x720 output, every 1/40 of the flight; the --sink curve is exact and --scale within 0.001 of progress as cubic-beziers, and --sink-curve is within 0.009 of the sine as linear() stops, so the measured difference is 1 px, 2 px at the worst corner). An ignored EGL test closes the same window twice toward the same live sink with a frozen clock, built-in and package (a test-only hook pins the package over the sink): the frames at 0, 100, 200 and 300 ms differ by 0 pixels beyond 1 px of slack, and strictly only by the 1 px shift of the placement; both end at 400 ms. The product draws the built-in close, as before, and no setting, command or capability selects the package.
  5. Later: window-open, window-focus, then window-border and window-rest, each with its WGSL port. The WGSL ABI of window-close for the plain scene landed on 2026-11-10 with the three example packages and parity tests against GLES, which were deleted with the GLES scene on 2026-11-11 (openspec/specs/themes/spec.md, Window-close WGSL ABI v1; openspec/changes/wgpu-renderer-plan/design.md, Phase 4, The window-close slot, ported).

Validation (2026-11-10)

  • History (the nine egl_ tests of black_hole_tests.rs, deleted on 2026-11-11 with the GLES close, step 7; their wgpu mirrors are native_wgpu_close_* and the native_wgpu_renderer_* tests of wgpu_renderer_black_hole_tests.rs). Offscreen EGL tests (ignored by default, run with --include-ignored): a theme close draws in place and ends; a broken reload keeps the pinned pass; a live sink keeps the built-in close (history: replaced on 2026-11-13, the theme pass now draws over a live sink); reduced motion draws nothing; scale, opacity, translate and margin place the drawn rectangle; the flip example starts as the window; the black-hole package matches the built-in close.
  • Nested run fc229509 (history: 2026-11-10, headless, one output, on the GLES renderer that was removed in steps 7 and 8): a v4 theme with a copy of effects/close-flip slowed to 1500 ms was written into the private profile and selected with scripts/smithay-effects.py select on the nested control socket, with no build or restart. The snapshot reported capabilities.windowEffectSlots: ["window-close"] and effects.windowEffects.close. A synthetic Zenity dialog closed with Super+Q turned in perspective, showed its back while it faded, and was gone in the next capture; the calculator behind it stayed. Captures kept locally outside Git.
  • Plain scene of the wgpu renderer (dated evidence; it was asked for with --renderer wgpu then, an option removed on 2026-11-11) (2026-11-10, RX 550, Vulkan RADV): the ignored GPU test native_wgpu_renderer_window_close_packages_match_gles (renamed native_wgpu_renderer_window_close_packages_start_static_draw_and_release when the GLES scene went, 2026-11-11) closed a window under both scenes with each example package selected in both and compared six progress points per package (and four more for the black-hole package pinned toward a live sink by the test hook): at most 2/255 per channel (1/255 for the black hole), 0 bytes at progress 0 and after the flight; the renamed test now checks that each package starts static, draws and releases, with no GLES reference. native_wgpu_renderer_window_close_follows_the_slot_rules keeps the pinned pass and its duration across a reload to another package, the built-in close under a live sink, no flight with reduced motion and no flight, with one attempt, after a failed pass. native_wgpu_renderer_theme_requests_compile_a_window_close_pass checks check, select, reload and disable with a WGSL package, a package with only GLSL and a broken WGSL.
  • Not verified: the live session, physical GPU cost, several outputs (the extra output draws the flight through the same code, but no parity test closes a window there) and the black-hole package against the real wallpaper sink (the theme close pass draws there since 2026-11-13).

Open questions for the owner

Decided by the owner on 2026-11-10 (architecture-decisions.md, Owner decisions on the audit of 2026-11-10), not built yet: a package draws on windows only after the user approves it in the protected host, select and reload refuse a package outside the approved profile path, and an effect for one window or application is proposed by a typed agent tool and approved by the user in the protected host. The first and third items below are answered by this; the GPU budget and the built-in replacement stay open.

  • Whether select and reload should refuse a package outside an approved path (for example a theme that the user approved in the protected host, or the distributed seeds), now that a window-close pass reaches the screen from a folder that execute_command can write. This branch does not change who may select a package.
  • Whether a window slot needs a draw-time GPU budget or watchdog, beyond the source limits.
  • Who may select a per-window or per-application effect, if anyone. This design applies a slot to every application window of the selected theme and gives no new path to choose one.
  • Whether a theme window-close slot, such as the black-hole-close package of phase 4, should replace the built-in black-hole close while the black-hole wallpaper is on (the proof says the swap is visually equivalent, and without it a theme cannot reach the sink), and whether a window-open slot replaces the built-in reveal.