Haze workspace transition
Doc status: proposal. Specification only; no haze shader or transition found in native/smithay. Checked 2026-11-11.
Note (2026-11-11): this proposal was written against the GLES depth pipeline (DepthPipeline, depth_transition_elements, GLSL haze.frag, egl_ tests). That pipeline and every .frag of the compositor's drawing path were removed on 2026-11-11 (step 7 of gles-removal-plan.md); the workspace transition is drawn only by the plain scene of the wgpu renderer (plain_depth.rs, plain_workspace.rs, plain_theme.rs, WGSL, openspec/specs/themes/spec.md). The file and line references, the GLSL contract and the EGL tests below describe the removed code and the design intent; an implementation starts from WGSL and the plain scene, and the fallback build draws a flat slide only.
Status: specification, decisions recorded in section 10. Nothing is implemented. Until the physical acceptance in "Validation plan" passes, the effect stays exploratory. Compiled shaders, EGL proofs and synthetic tests do not validate the look.
1. Purpose and scope
1.1 What "haze" means here
Haze is an in-place transition between two workspaces. The planes do not slide. The outgoing workspace wavers like hot air, goes soft under a light mist, and dissolves in organic patches into the incoming workspace. The incoming workspace then comes into focus as the mist clears.
The effect has five parts:
- Shimmer. A low-frequency UV distortion that moves over time.
- Softening. A blur of both planes that peaks at the midpoint.
- Veil. A milky color lift that peaks at the midpoint.
- Dissolve. A noise-threshold mask that moves the pixels from the outgoing plane to the incoming plane. It is not a uniform alpha mix.
- Direction cue. The patches open first on the side of the target workspace, and the incoming plane drifts in a little from that side.
Only the top bar, the bottom bar and the cursor stay fixed and sharp in every frame (native/smithay/src/desktop.rs:496-499). The bar glass blurs the haze behind it. The chat, the protected composer, inline documents and web panels are part of each workspace plane, so they take the haze (native/smithay/src/scene.rs:709-710). If they must stay sharp, the spec needs a new rule, and the scene must exclude them from the plane.
1.2 In scope
- The workspace switch on the primary output, from all triggers:
- a keyboard switch;
workspace_command;- a three-finger swipe, with hold, release and spring-back.
- A new transition kind
hazein the theme contract, manifest v4. - A reference shader that the compositor owns, plus an optional theme shader that a probe must accept.
- A new built-in theme
haze. Studio does not change. - A fallback ladder, a GPU budget, a performance status and the validation steps.
1.3 Out of scope
- The overview open and close. The visible overview is a web dialog. Picking a card runs a 300 ms card-to-full zoom (
web-shell/host/workspace-zoom.js:2,83-95,129-142). Opening has no zoom. A haze there is host CSS and needs its own spec. - The compositor F9 overview. It cannot be reached (see 2.5).
- Window map. It keeps the 700 ms built-in noise reveal (
native/smithay/src/window_finish.rs:15-50). - Window close and minimize. These have no animation. Close keeps no buffer after destroy (
native/smithay/src/handlers/xdg_shell.rs:135-152). Minimize only setsminimized = true(native/smithay/src/desktop.rs:1570-1576). - Extra outputs. They keep the current behavior and get no transition.
- A carry plane on a third-workspace interruption. The current snap stays in v1 (see 5.6).
- New authority. Generated HTML gets nothing new, and no tool gets new authority.
- Dragging windows between overview cards. This feature is never part of this or any later spec.
2. Current state
All paths are relative to the repository root, at commit 5b09665.
2.1 Transition state machine
- The phases are Dragging, AwaitingCommit, Animating and Springing.
WorkspaceFrameexposes onlyfrom_workspace,to_workspace,progressandtoward_next(native/smithay/src/workspace_transitions.rs:22-57). - Each Visual captures its profile when it starts. A theme reload changes only the next transition (
workspace_transitions.rs:59-68,323-336). - The cubic-bezier eases the progress (
workspace_transitions.rs:511-531). The remaining and spring durations areduration_ms * clamp(sqrt(distance), 0.47, 1.0)(workspace_transitions.rs:533-541). So a short remainder still takes at least 47 % of the profile duration. The haze timeline must allow for this floor. - A three-finger swipe sets progress = |dx|/width, clamped to 0.96 (
workspace_transitions.rs:151-188). A swipe needs at least 80 px and 1.5x horizontal dominance (workspace_transitions.rs:11-12,193-196). - After release, the visual waits for the core (
workspace_transitions.rs:238-252). On acknowledge, or after 1200 ms, it completes if the logical workspace is the target and springs back if not (workspace_transitions.rs:339-367,375-395). The timeout never switches the workspace (workspace_transitions.rs:369-370). set_motion(false)drops the gesture and the visual (workspace_transitions.rs:92-98).animate:falsecancels the visual (workspace_transitions.rs:272-276).- Motion is off at startup until the host reports its preference (
workspace_transitions.rs:71-78). - While a visual exists, pointer focus, buttons and scroll on the primary output are swallowed (
workspace_transitions.rs:453-455;thumbnail_motion.rs:109-111;input.rs:208,587-597,671-677,700-706). Keyboard input and pointer input on extra outputs still go through.
2.2 Scene and renderers
SceneElementalready has anEffectRaw=TextureRenderElement<GlesTexture>variant (native/smithay/src/scene.rs:17-31).- A locked session returns
lock_elementsbefore any transition code (scene.rs:43-46). This return also skipsworkspace_depth.clear()atscene.rs:77, so the depth targets stay allocated while the session is locked. - When a
WorkspaceFrameexists, the scene pins the theme runtime withworkspace_depth.begin. It then triesdepth_transition_elementsand falls back totransition_elements, the flat slide (scene.rs:69-75). - At rest,
workspace_depth.clear()releases the targets and resets the failure latch (scene.rs:77;native/smithay/src/workspace_depth.rs:128-134). - The depth path draws the fixed chrome and the cursor untransformed (
scene.rs:607-619). Onlycrate::layers::is_barwindows are fixed: the bottom bar and the top bar. - Plane sources: the cached web plane or live web elements, plus the non-shell
Slot::Primarywindows of the workspace (scene.rs:625-650,833-861). The plane order flips at progress 0.5, so the incoming plane is on top after it (scene.rs:620-624). - The depth path renders the wallpaper only when a live wallpaper window exists (
scene.rs:651-688). It applies the bar glass last (scene.rs:690). - The output must be at most
MAX_PIXELS = 8_388_608pixels (workspace_depth.rs:23,179-186).DepthPipelineholds at most three targets, each with two full-output textures (workspace_depth.rs:196-211). A haze that needs extra targets must raise this cap. beginpins the flight once (workspace_depth.rs:135-140). A render error clears the targets and latchesfailedfor the rest of the transition (workspace_depth.rs:148-167).- The depth card elements use global alpha 1.0 (
alpha: None) and declare no opaque region. Texture alpha and rounded corners still blend (workspace_depth.rs:244-304).
2.3 Theme contract
Settingshas 12 keys withdeny_unknown_fields. The default is 200 ms with easing [0.33333334, 1, 0.6666667, 1] (native/smithay/src/workspace_theme.rs:8-41). The bounds are atworkspace_theme.rs:42-65.compile()gives the texture shaderu_axis,u_limits,u_uv_origin,u_uv_size,u_card_size,u_radiusandu_dim. It gives the pixel shaderu_extent,u_card_size,u_radiusandu_strength(workspace_theme.rs:103-135). There is no progress, time, direction or second-sampler uniform.- The manifest accepts versions 1 to 3 only (
native/smithay/src/themes.rs:590-591).workspaceTransitionis v3 only and holds onlypathandenabled(themes.rs:594;web-shell/core/themes.js:208-220). workspace_transition()returns None when effects are disabled or the package is disabled (native/smithay/src/effect_pipeline.rs:519-529).- Theme effects bind extra textures with raw GL on units 1..n around an offscreen pass (
effect_pipeline.rs:126-157). Their sampler uniforms areu_tex_<alias>of type_1i(native/smithay/src/effects.rs:139-142). compile_themecompiles the workspace package before the effects (effect_pipeline.rs:313-323).theme_selectpersists only after a successful compile.theme_checkcompiles and drops the result.reloadreplaces the runtime only on success (effect_pipeline.rs:408-440).sync_requestruns at the start of every primary scene, also while locked (scene.rs:40).secondary_elementsdoes not call it (scene.rs:339-367). It sets the transition profile and publishes the status throughpublish_status(effect_pipeline.rs:503-508,541-544).create_themeacceptsworkspaceTransition {enabled?, settings?, effect, shadow}(web-shell/core/theme-create.js:84-94,220-245). It refuses textures, because its input has a closed key list (theme-create.js:40-47,142). Its post-select check does not check that the transition is reported as enabled (theme-create.js:533-540).- The host approval card shows "transição de workspace" when a package is present (
vendor/interface/host/host.js:1457). The sharedapprovalDialoghas a 1500 ms arming delay, which restarts when the shell loses visibility or focus (host.js:591-640). - The host reads
durationMsandeasinginto--workspace-motion-durationand--workspace-motion-easing(vendor/interface/host/host.js:1721-1742). When the package is disabled or missing, the host uses 200 ms andcubic-bezier(0.22,1,0.36,1). This easing differs from the compositor default.
2.4 Frames and motion
- DRM renders the primary output on every vblank, plus a 16 ms timer, and waits on
rendered.syncbefore KMS (native/smithay/src/drm.rs:177-232). Winit asks for a redraw on every frame (native/smithay/src/winit.rs:65-128). The haze needs no new frame scheduling. - An extra output uses
secondary_elementswith no transition (scene.rs:334-367). It flips only when damaged (drm.rs:235-290). - Reduced motion takes this path:
- Host
matchMedia(web-shell/host/workspace-zoom.js:219-250). POST /api/workspace-motion(web-shell/core/server.js:1206-1214).- The
workspace_motionRPC (native/smithay/src/desktop.rs:1367-1381). set_motion.
- Host
- These paths cancel a running visual at once:
- every presentation change, in any mode (
desktop.rs:1076-1079); - maximize and restore (
desktop.rs:1617-1620;desktop/tiling.rs:481-484); - the end of an overview swipe (
state.rs:154); animate:false(desktop.rs:1404-1405);- lock entry (
session_lock.rs:788).
- every presentation change, in any mode (
2.5 What cannot be reached
No production code sets state.overview to true (native/smithay/src/state.rs:277; desktop.rs:1095,1637). So the overview-f9 effects and their u_time cannot run. The haze must not depend on them.
2.6 Validation status of the existing transition
The depth package has offscreen EGL proofs. Integrated acceptance on the desktop is pending (openspec/specs/themes/spec.md:275-282). The synthetic compositor does not compile GLSL (openspec/specs/themes/spec.md:212-213).
3. Visual definition
3.1 Terms
pis the eased progress, from 0 to 1. It isWorkspaceFrame.progressas it is, already eased by the compositor (workspace_transitions.rs:415-451). During a held swipe it is the raw finger fraction. The haze must not apply the easing a second time.eis the envelope. It is exactly 0 when p is 0 or 1, and sin(pi*p) for any other p. This is the same rule asworkspace_depth.rs:52-57.diris +1 toward the next workspace and -1 toward the previous one.f(x)is the dissolve field, clamped to [0, 1]. It ismix(noise(x), ramp(x), sweep). The ramp is1 - x.ufor next andx.ufor previous, so that next opens from the right.tismix(-edge, 1 + edge, p).mis the mask,smoothstep(f - edge, f + edge, t). For f in [0, 1], m is exactly 0 at p = 0 and exactly 1 at p = 1.
3.2 Timeline
The percentages are values of eased progress p, not wall time. The values use the defaults.
The mask coverage figures are estimates for a uniform field f. The 4.4 shader does no equalization, and two-octave value noise is concentrated near 0.5. So the reference shader gives less coverage at 25% (a few percent) and more at 75% (about 95%). The EGL midpoint test measures the real coverage.
| p | Shimmer | Blur | Veil | Mask coverage | Drift of incoming | What the user sees |
|---|---|---|---|---|---|---|
| 0% | 0 px | 0 px | 0 | 0 everywhere | 0.02 W, not visible | The outgoing workspace, identical to the rest frame. |
| 25% | 2.8 px | 4.2 px | 0.16 | about 15-25%, biased to the target side | 0.015 W | The outgoing workspace shimmers and softens. The first patches of the incoming workspace open on the target side. |
| 50% | 4 px | 6 px | 0.22, stronger on patch edges | about 50% | 0.01 W | Peak haze. Both layouts are soft, and no sharp double text shows. |
| 75% | 2.8 px | 4.2 px | 0.16 | about 75-85% | 0.005 W | The incoming workspace covers most of the screen. The mist clears. |
| 100% | 0 px | 0 px | 0 | 1 everywhere | 0 | The incoming workspace, sharp. The next frame is the normal rest scene, and the targets are released. |
During a held swipe, p follows the finger and the shimmer keeps moving. A spring-back runs the same timeline in reverse.
3.3 Parameters
These keys go in settings.json for kind haze. Rust and JS both refuse unknown keys and values out of bounds.
| Key | Type and range | Default | Effect |
|---|---|---|---|
durationMs |
integer 120..1200 | 280 | Full duration of a command switch. |
easing |
4 numbers, each 0..1 | [0.4, 0, 0.2, 1] | Cubic-bezier for p. |
distortion |
0..12 px | 4 | Peak shimmer UV offset. |
noiseScale |
32..512 px | 160 | Feature size of the shimmer and the dissolve noise. |
shimmerHz |
0..3 | 0.8 | Shimmer loop speed. |
blur |
0..12 px | 6 | Peak blur radius of both planes. |
veil |
0..0.5 | 0.22 | Peak veil strength. |
veilColor |
3 numbers, each 0..1 | [0.92, 0.94, 0.97] | Veil color, straight RGB. |
edge |
0.02..0.5 | 0.16 | Softness of the dissolve edge. |
sweep |
0..1 | 0.35 | Mix of the directional ramp into the dissolve field. |
drift |
0..0.05 of width | 0.02 | Start offset of the incoming plane from the target side. It is scaled by (1 - p). |
These values are fixed and a theme cannot set them: the envelope, the mask formula, the in-place geometry, the endpoint rule and the fixed chrome on top.
durationMs and easing keep their current names, so the host CSS variables keep working with no change.
4. Theme contract
4.1 Manifest v4
{
"version": 4,
"id": "haze",
"name": "Haze",
"shell": { "...": "same as v3" },
"workspaceTransition": { "path": "effects/workspace", "enabled": true, "kind": "haze" }
}
kindis required in v4. It is"depth"or"haze".kindis refused in v1 to v3 with the error "kind requires manifest v4". A v3 package meansdepth, so every existing theme loads with no change.- The manifest-level v3 rules stay the same in v4: textures, effects and the 512 KiB aggregate. The package rules change by kind (see 4.2).
- In the core,
validateManifestaccepts version 4 andkind(web-shell/core/themes.js:199,211,215).readThemeStylebranches onkind(themes.js:337-349). For haze, it readssettings.jsonand an optionalhaze.frag, and checks the settings withvalidateHazeSettings. - A compositor built before this change refuses the package with a
theme.jsonparse error about the unknown fieldkind(native/smithay/src/themes.rs:57-62,291-292). Sotheme_checkfails before the approval card, and nothing applies early. - The compositor reports
textureSupport.maxManifestVersionfromeffects_max_manifest_version.publish_statusraises it from 3 to 4 (effect_pipeline.rs:543;desktop/snapshot.rs:117).
4.2 Package files for kind haze
| File | Rule |
|---|---|
settings.json |
Required. At most 8 KiB. HazeSettings in 3.3, with deny_unknown_fields. |
haze.frag |
Optional. At most 32 KiB, GLSL ES, one line that is only //_DEFINES_, no #version, no NUL. Without the file, the compositor uses its built-in native/smithay/src/haze.frag. |
effect.frag, shadow.frag |
Refused for kind haze, with a clear error. The loader reads only named files and does not list the directory (workspace_theme.rs:76-85). So this refusal needs a new existence check in the loader. |
| Symlinks | Refused by checked_path, the same as today (themes.rs:236-238). |
| Textures | create_theme has no texture input, so the core refuses them. The compositor package loader does not refuse them. |
4.3 Shader inputs
The compositor compiles the shader with compile_custom_texture_shader. The CPU scales every strength by the envelope, so the endpoints stay exact even before the shader mixes.
| Uniform | Type | Value |
|---|---|---|
tex |
sampler2D, unit 0 | Outgoing plane: premultiplied, opaque, full output. |
alpha, v_coords |
standard | As in every texture shader. |
u_next |
_1i = 1 |
Incoming plane on unit 1, an internal GlesTexture (never EXTERNAL). |
u_size |
_2f |
Output size in pixels. |
u_limits |
_4f |
Half-texel clamp rectangle of the full output. |
u_progress |
_1f |
p. |
u_envelope |
_1f |
e. |
u_direction |
_1f |
+1 or -1. |
u_time |
_1f |
Seconds since the flight began, wrapped at 64 s. |
u_phase |
_1f |
2*pi*fract(elapsed * shimmerHz). The CPU computes it in f64, so the loop never jumps. |
u_seed |
_1f |
fract(n * 0.618034) for transition number n. Tests can fix it. |
u_distortion |
_1f |
distortion * e, in px. |
u_blur |
_1f |
blur * e, in px. |
u_veil |
_1f |
veil * e. |
u_veil_color |
_3f |
veilColor. |
u_noise_scale |
_1f |
noiseScale. |
u_edge |
_1f |
edge. |
u_sweep |
_1f |
sweep. |
u_drift |
_1f |
drift * (1 - p). |
The shader must declare every uniform that it reads. A uniform that it does not declare gets location -1, and the set call does nothing.
4.4 Reference shader behavior
The built-in haze.frag is about 120 lines and uses no textures. It works in these steps:
- Two-octave value noise of
px / u_noise_scale, offset byu_seed. - A warp vector from two noise lookups at
(cos u_phase, sin u_phase)offsets, timesu_distortion / u_size. - The dissolve mask
mfrom 3.1. - The outgoing plane, sampled at
uv + warp. The incoming plane, sampled atuv - warp - (u_direction * u_drift, 0). All coordinates are clamped tou_limits. - When
u_blur >= 0.5, a 1+8 tap disc of radiusu_blurper plane. Otherwise 1 tap. color = mix(a, b, m). Thencolor.rgb = mix(color.rgb, u_veil_color, clamp(u_veil * (1 + 0.5 * (1 - abs(2m - 1))), 0, 1)).
The peak cost is 18 texture fetches per pixel. At haze-lite (L1, see 6.1), it is 2 fetches.
4.5 Endpoint probe
The compositor runs this probe for every haze runtime, built-in or theme. It runs in theme_check, theme_select, reload and at startup.
- It renders the program offscreen at 64x64 with two test planes, a gradient and a checker.
- The test planes get the same texture setup as target B in 5.1: LINEAR filters and CLAMP_TO_EDGE wrap.
- It renders at
u_progress = 0and atu_progress = 1, with every envelope-scaled strength at 0. - Each result must match
texandu_nextwithin 2/255 per channel. - In
theme_check,theme_selectandreload, a failure is a compile failure. The error is limited to 512 bytes bylimit_error(effect_pipeline.rs:33,488-493,777-786). - At startup, a haze compile or probe failure sets only
workspace_transitionto None and keeps the rest of the theme. This is new behavior. Today any startup compile error leavesactive = None, with no effects and no workspace package (effect_pipeline.rs:235-238,313-323).
The probe rejects a shader that ignores u_next or keeps a veil at the end. It does not test the warp or the limits, because every strength is 0 at both endpoints. The EGL midpoint test in 8.2 checks the limits of the built-in shader only. The probe uses three 4096 px textures and frees them at once.
4.6 Compile and approval flow
There is no new authority. The flow is the existing one, with these core changes in web-shell/core/theme-create.js:
- The tool schema:
kindis a new key, andrequired: ["effect", "shadow"]applies to depth only (theme-create.js:84-94). - The runtime key check accepts
kind(theme-create.js:224-226). MANAGED_FILEacceptsworkspace-transition/haze.frag(theme-create.js:319-320). Without this,installThemethrows "Unexpected theme file" (:396), andreadManagedThemerefuses the folder as foreign (:349).buildwrites version 4 for kind haze. Today it always writes version 3 (theme-create.js:252).- The summary carries
kindto the approval card.
The steps:
- The agent calls
create_themewithworkspaceTransition {enabled?, kind: "haze", settings?, effect?}. For haze,effectis optional and becomeshaze.frag, andshadowis refused. The core writes v4 only for kind haze, and keeps v3 for depth. - The core checks the input.
validateHazeSettingsmirrors the Rust bounds, and the shader checks are the same as in 4.2. - The core writes the staging folder
check-<12hex>. The compositor runstheme_check, which loads, compiles and probes, and then drops the result. Nothing persists. - The protected host card asks the user. It shows "transição de workspace: haze" and whether the theme gives its own shader (
host.js:1457). The card keeps the 1500 ms arming delay and the 120 s timeout. theme_selectcompiles and probes again, and persists only on success.- The post-select check requires
effects.workspaceTransition.enabledto be true andkindto be"haze". Any failure rolls back, as today.
Built-in slugs stay reserved, and haze becomes one of them. In a checkout, the folder native/smithay/themes/haze reserves the slug (theme-create.js:123-135). An installed release without the checkout uses FALLBACK_BUILT_IN, so haze is added there (theme-create.js:23). Then neither studio nor haze is ever overwritten.
4.7 Status
workspace_transition_status adds two fields:
kind:"depth"or"haze".perf:{transitions, frames, p95Ms, maxMs, degraded, worstLevel}, cumulative since the last theme selection or reload. A bounded histogram of frame times givesp95Ms.
The status keeps settings.durationMs and settings.easing for the host. Both fields are written in publish_status (effect_pipeline.rs:541-544).
5. Compositor integration
5.1 Render path, per frame, while a haze flight runs
-
Planes. The pipeline renders the
fromsource into target A and thetosource into target B. It usesOutputDamageTracker::render_output, with one tracker per target that persists across the flight, so an unchanged plane redraws only its damage. Each source holds:- the cached or live web plane and the non-shell
Slot::Primarywindows of that workspace, as inscene.rs:625-650,833-861; - the wallpaper at full output, as in
scene.rs:651-669.
The targets are cleared to the opaque
state.clear_color(), not to [0,0,0,0] as depth does (workspace_depth.rs:219). So each plane is opaque even with no live wallpaper window, and nothing shows through the mix. The outgoing web plane stays frozen, as today. - the cached or live web plane and the non-shell
-
Composite. The pipeline renders one
TextureShaderElementover A with the haze program into target C. B is bound on unit 1 with rawActiveTextureandBindTexturearound thatrender_output, and the state is restored after. This is the pattern ofeffect_pipeline.rs:126-157. The composite uses a fresh damage tracker, becauseu_phasechanges every frame.After B is allocated, the pipeline sets
TEXTURE_MIN_FILTERandTEXTURE_MAG_FILTERto LINEAR and the wrap to CLAMP_TO_EDGE on B, then restores the active unit. This is the wayupload_texturedoes it (effect_pipeline.rs:108-114). Smithaycreate_buffersets no filter, andrender_texturesets filters only on the unit-0 texture. Without this step, B keeps the GL defaultNEAREST_MIPMAP_LINEARwith no mipmaps, so B is incomplete andu_nextsamples black. -
Output. The pipeline emits C as one
EffectRawelement at (0, 0), full output. The fixed chrome and the cursor go above it, as inscene.rs:607-619, and thenapply_glassruns last, as inscene.rs:690. No newSceneElementvariant is needed.
The composite stays offscreen in v1, because the raw unit binding must wrap a draw that runs at once. A custom RenderElement draw, the window_finish.rs:160-212 pattern, could later remove target C.
5.2 Extension points
| Change | Location |
|---|---|
HazeSettings, HazeLoaded::load, compile with the 4.3 uniform list, and the probe |
native/smithay/src/workspace_theme.rs (beside :8-65 and :103-135) |
A runtime enum Transition { Depth(Runtime), Haze(HazeRuntime) } with motion() -> (durationMs, easing) |
workspace_theme.rs |
The v4 version check and kind on the manifest entry |
native/smithay/src/themes.rs:38-62,589-612 |
| Load by kind, counted in the 512 KiB aggregate | themes.rs:346-368 |
| Compile and probe either kind, return the kind, and keep the theme when the startup haze compile fails | effect_pipeline.rs:235-238,313-323,408-440 |
Publish kind and perf, and raise effects_max_manifest_version from 3 to 4 |
effect_pipeline.rs:541-544 |
The profile type of Visual and WorkspaceTransitions changes from the depth Settings to a motion type (duration and easing). set_profile takes the motion of either kind. The phases, gesture, blocks_pointer and set_motion do not change |
workspace_transitions.rs:61,72,81-83; caller effect_pipeline.rs:503-507 |
New HazePipeline {a, b, c, trackers, flight, pair, started_at, seed, level, failed} with begin(runtime, now, from, to), clear, render and the same latch as workspace_depth.rs:148-167 |
native/smithay/src/workspace_haze.rs (new) |
New field workspace_haze on Compositor, beside workspace_depth |
native/smithay/src/state.rs:39,272 |
Built-in shader, through include_str! |
native/smithay/src/haze.frag (new) |
| Kind branch: haze, then the flat slide on None. Depth, then the flat slide on None | scene.rs:69-75 |
| Clear haze at rest | scene.rs:77 |
| Clear haze on lock | scene.rs:43-46 |
Frame time for the guard, written after rendered.sync |
drm.rs:177-232 |
Only one of depth and haze holds targets during a flight. The two pipelines are sibling fields on Compositor, so neither can clear the other. The kind branch at scene.rs:69-75 does the mutual clear: it clears depth before haze begins, and haze before depth begins.
begin pins the runtime while the (from, to) pair stays the same, like depth. When the pair changes, begin starts a new flight: a new runtime, a new started_at and a new seed. WorkspaceFrame carries no visual identity (workspace_transitions.rs:22-29), so the pair is the flight key.
5.3 Multi-output
- The haze runs on the primary output only. Its geometry comes from the first output, as today (
scene.rs:587-591). - Extra outputs keep
secondary_elementswith no transition (scene.rs:334-367). The haze must add no damage to them, so they still flip only on their own damage (drm.rs:235-290). - The GPU is shared, so the budget in section 7 is measured with both outputs connected.
5.4 Overview
Every presentation change, including entry to Presentation::Workspaces, cancels the visual (desktop.rs:1076-1079). The next scene then reaches scene.rs:77 and clears the haze. The 300 ms host zoom does not change. The F9 overview stays unreachable, and the haze does not touch it.
5.5 Lock
The lock frame draws no transition (scene.rs:43-46). The haze adds workspace_haze.clear() to that branch, so no workspace pixels stay in haze targets while the session is locked. The same gap exists for depth targets today. Fixing depth is a separate change, with its own test.
5.6 Interruption
- A reversal toward
fromortokeeps the same two planes and the same flight. The mask runs backward, with no jump. - A switch to a third workspace keeps the current behavior: a new visual from the logical workspace at progress 0 (
workspace_transitions.rs:316-336). The screen snaps once. A carry plane is open question 5. - No rest frame comes between the two visuals, so the clear at
scene.rs:77does not run. The pair change inbegin(5.2) restartsu_time,u_seedand the pinned runtime for the new flight. animate:false,set_motion(false), lock, any presentation change, maximize or restore, and the overview swipe end the flight at once.
5.7 Capture and preview
scripts/capture-desktop.pyreads the composed frame. A capture during a haze returns the blended frame that the user sees. This is documented, not hidden.- The workspace preview PNG for the host zoom renders on its own path (
scene.rs:966-990). It must stay free of haze. - Window capture ("Mostrar ao agente") does not change.
6. Fallbacks and motion settings
6.1 Fallback ladder
The compositor decides each level per transition. No level ends the compositor.
| Level | What draws | Entered when |
|---|---|---|
| L0, full haze | Shimmer, blur, veil, dissolve, drift | Default for a haze flight. |
| L1, haze-lite | The built-in shader with u_distortion = 0 and u_blur = 0: veil, dissolve and drift only |
The budget guard trips once in L0. |
| L2, flat slide | transition_elements (scene.rs:694-815) |
A render, allocation or bind error (the latch). An output larger than 8,388,608 px. The guard tripped in L1 during the previous flight. The kind is haze but the runtime is None. The theme or the package is disabled. |
| L3, instant | No animation | Reduced motion, workspace_motion false, the startup default, animate:false, lock, any presentation change, maximize or restore. |
- L1 always uses the built-in shader, also when the theme gives its own
haze.frag. A theme shader can ignoreu_distortionandu_blur, so only the built-in shader lowers the cost. L1 still renders both planes, so it removes only composite fetches. - A guard trip in L1 keeps L1 to the end of that flight. The next flight then runs at L2, and the flight after it starts again at L0.
- A step to L2 in mid-flight is a visible jump from a dissolve to a slide. The flat slide offsets the planes by p * width (
scene.rs:783-815). This happens only on a render, allocation or bind error. - Each step logs a warning and increments
perf.degraded. - A compile or probe failure in
theme_check,selectorreloadnever reaches the ladder.create_themestops attheme_check, with no approval card.selectandreloadkeep the previous runtime. - A haze compile or probe failure at startup gives a None haze runtime and keeps the rest of the theme (see 4.5). So the flight runs at L2.
6.2 Budget guard
- The guard trips on 3 consecutive frames over 14 ms, or on 1 frame over 33 ms.
- The first frame of a flight, and the first frame after a target allocation, do not count for the 33 ms rule. That frame creates the targets and renders both planes in full, and the first draw of a program can be slow on a driver.
- The measured value is the primary scene and GPU time. It runs from the scene start to the end of the
rendered.syncwait on DRM (drm.rs:190-200). - These parts are not counted: the workspace preview before the scene (
drm.rs:187-189), the capture readback (drm.rs:203-208) and the second output render (drm.rs:170-173). - On winit, the guard is off, and
perfreports only the frame count.
6.3 Motion settings
The haze runs only inside WorkspaceTransitions::frame(). So these settings turn it off with no new code: reduced motion, workspace_motion false, animate:false and the startup default.
The haze adds no new motion setting. The 700 ms map reveal still ignores reduced motion. That is outside this spec.
7. Performance budget
7.1 Reference setup
- Integrated GPU.
- Primary output 1920x1080 at 60 Hz, plus a second 1920x1080 output.
- Also measured at 1366x768, if the user's display has that size.
7.2 Targets
| Item | Budget |
|---|---|
| Primary scene and GPU time during a haze, p95 | 12 ms or less |
| Single frame maximum before the guard steps down | 33 ms |
| Pointer block | While the visual exists (see below) |
| Cost at rest | 0 passes, 0 bytes |
The plan has no per-pass timer, so the added cost of the haze passes is not a target. The p95 row is the only frame-time target.
Only the pointer is blocked, not all input, and only while the visual exists:
- A command switch blocks it for
durationMs(280 ms default, 1200 ms maximum). Each reversal adds a new remaining duration. - A swipe blocks it for the hold time and up to 1200 ms awaiting the commit. Then it adds a remaining duration of 0.47 to 1.0 of
durationMs.
7.3 Estimates
These numbers are not measured.
- Composite at L0. 2,073,600 px x 18 fetches = about 37 M fetches per frame at 1080p. At L1 it is about 4 M.
- Plane renders. Damage-only after the first frame of the flight.
- Compared with depth. About the same cost as depth, which uses 3 planes x 2 passes x 5 fetches plus a shadow.
7.4 Memory
The pipeline enforces these limits in code:
- At most 3 targets (A, B, C), each 8,388,608 px or less, so 96 MiB or less.
- At 1920x1080: 3 x 8.3 MB = about 25 MB.
- At 1366x768: 3 x 4.2 MB = about 12.6 MB.
- A larger output goes to L2.
- The probe uses 3 textures of 64x64, which are freed at once.
- The documented 192 MiB depth budget and the 128 MiB web cache budget do not change (
openspec/specs/visual-effects-3d-shaders/spec.md:279-288).
GLSL stays trusted GPU code, with no sandbox and no GPU timeout (openspec/specs/themes/spec.md:115,259-260). The bounds limit the uniform values, not the cost of a theme shader. A heavy theme shader can stall a frame before the guard reacts. After the guard trips, L1 replaces the theme shader with the built-in shader (see 6.1).
8. Validation plan
The effect is validated only when every step below passes, including step 7 and its measurement. Until then, openspec/specs/visual-effects-3d-shaders/spec.md records the haze as exploratory.
Interactive checks are planned to run in the nested QA launcher scripts/nested-qa.py, which is being added in parallel and does not exist yet.
8.1 Rust unit tests
HazeSettings: the defaults, every bound, and the refusal of unknown keys.- The manifest:
- v4
kindparses; kindin v3 is refused;- every checked-in v3 theme loads with no change;
- Studio depth output is bit-identical on a sample of p values.
- v4
- The package: haze with no
haze.fraguses the built-in shader.effect.fragorshadow.fragin a haze package is refused. - The envelope is exactly 0 at p = 0 and at p = 1.
u_phaseis continuous across 64 s.- The seed changes per transition and can be fixed in tests.
- An output over
MAX_PIXELSis refused. - With a fake clock, the guard steps L0 to L1 in a flight and keeps L1 to its end. The next flight runs at L2.
- The first frame of a flight does not count for the 33 ms rule.
set_motion(false),animate:false, lock and overview entry each give no haze elements and release the targets.
8.2 EGL offscreen tests
These tests are ignored by default and need EGL. They follow the pattern of egl_depth_blurs_only_moving_cards_and_lands_pixel_sharp (deleted 2026-11-11; mirror native_wgpu_depth_blurs_only_moving_cards_and_lands_pixel_sharp, wgpu_renderer_workspace_tests.rs).
egl_haze_endpoints_are_pixel_exact: the composite at p = 0 equals thefromsource, and the scene at p = 1 equals the rest scene.egl_haze_midpoint_shows_both_planes_inside_limits: red and blue planes give both colors at p = 0.5. A sentinel color outsideu_limitsnever appears.egl_haze_bar_strip_and_cursor_stay_sharp: these rows match the source in every frame. This also catches GL texture-unit state that a pass forgot to restore.egl_haze_probe_rejects_a_shader_that_ignores_u_next: the probe rejects the shader, with a diagnostic of 512 bytes or less, andselectkeeps the old chain.egl_haze_render_failure_keeps_the_flat_slide: the flat slide draws for the rest of that flight, and the next flight tries haze again.egl_haze_reload_pins_the_current_flight: a reload changes only the next flight.egl_haze_preview_png_has_no_haze.- The existing depth EGL tests still pass with no change.
8.3 Core and host tests
validateHazeSettingsand the Rust bounds read one shared fixture table of in-bounds and out-of-bounds cases.create_themekind haze:effectis optional andshadowis refused;- the core writes v4;
- the post-select check requires
enabledandkind; - a failure rolls back.
- The slug
hazeis reserved. - A synthetic core in a browser shows the haze line on the approval card. This step needs no live provider.
8.4 Gates
web-shell:npm run format:check,npm run checkandnpm test.- Rust:
cargo fmt --check --manifest-path native/smithay/Cargo.toml;python3 scripts/prepare-project.py --root "$PWD" --cargo test --locked --features session;python3 scripts/prepare-project.py --root "$PWD" --cargo clippy --locked --features session --all-targets -- -D warnings.
- EGL, on a machine with EGL:
python3 scripts/prepare-project.py --root "$PWD" --cargo test --locked --features session -- --ignored egl_. Every EGL test is#[ignore](workspace_depth.rs:418), so the normal test gate does not run them. This run covers the haze tests and the existing depth EGL test. - Python: the suite, in an environment without
AGENT_NATIVE_*,DISPLAYorWAYLAND_DISPLAY.
8.5 Delivery
Delivery has four separate steps, and each is recorded:
- Publish to main.
- Run
python3 scripts/sync-active-checkout.py --label <worktree>. It also runsscripts/prepare-project.py, so it builds (scripts/sync-active-checkout.py:93-99). Record the build result. - The next login.
- Real activation. Confirm that the running compositor has the commit (
openspec/specs/project-loading/spec.md, section Coordination and activation). Then copy the haze theme to the theme root and select it (see 8.7).
Nothing restarts the live compositor.
8.6 Synthetic capture checks
These run in EGL tests only. Captures of the live desktop belong in 8.7.
- A capture during a haze returns a frame that is not black and is blended.
- The preview PNG is clean.
8.7 Physical acceptance at the next login
The user must do these steps, because the agent has no input automation.
- Copy
native/smithay/themes/hazeto${XDG_CONFIG_HOME:-$HOME/.config}/agent-native-os/themes/haze(openspec/specs/themes/spec.md:12). Then runpython3 scripts/smithay-effects.py --socket <session socket> select haze. A built-in theme has no approval card, andcreate_themerefuses the slughaze. Test the approval card separately, withcreate_themekind haze and a user slug. - Do 20 keyboard switches with both outputs connected. Then the agent runs a read-only status query. The cumulative
perfmust showtransitions >= 20,p95Ms <= 12,degraded = 0andworstLevel = L0. - Before the user starts the swipe, the development agent starts a delayed capture, for example
sleep 5; python3 scripts/capture-desktop.py .... Then the user holds a three-finger swipe at about half the width. The product agent cannot do this step. The capture is never committed. - Release the swipe, and also test a spring-back.
- Check the look at the start, the middle and the end. Check that the first and the last frames do not jump.
- Check that the bar and the cursor stay sharp, and that the second output does not change.
- Turn on reduced motion, and see an instant switch.
- Lock during a haze. Enter the overview during a haze. Switch to a third workspace during a haze.
- Select Studio again, and see the depth slide with no change.
The report gives four proofs separately:
- the browser, with a synthetic core;
- the Electron host, with the approval card and the status;
- EGL offscreen;
- real system control at the next login.
9. Implementation steps
Each step merges on its own and has its own test.
- Settings. Add
HazeSettingsand validation in Rust, andvalidateHazeSettingsin JS, with the shared fixture table. Test: unit tests on both sides. - Manifest v4. Add
kindinthemes.rsandthemes.js. Inthemes.js,validateManifestaccepts v4, andreadThemeStylebranches onkind(see 4.1). Raiseeffects_max_manifest_versionto 4. v1 to v3 do not change. Test: parse tests,import_theme_styleon a haze theme, and every theme in the checkout loads. - Built-in shader and loader. Add
haze.frag,HazeLoaded::loadandcompilewith the 4.3 uniforms. Test: an EGL compile test, and the error is 512 bytes or less. - Endpoint probe. Add the probe to check, select, reload and startup. At startup, a haze failure keeps the rest of the theme. Test: the probe EGL test.
HazePipeline. Add the targets with LINEAR filters and CLAMP_TO_EDGE on B,begin(runtime, now, from, to),clear, the pixel limit, the latch, and pure uniform functions. Test: unit tests for the envelope, the phase and the seed. EGL tests for the endpoints, the midpoint and the limits.- Scene integration. Add the
workspace_hazefield instate.rs, and the kind branch atscene.rs:69-75with the mutual clear. Add the clear at rest and on lock, andkindin the status. Test: synthetic tests for the motion, lock and overview cases. The bar strip EGL test. - Perf status and guard. Add the frame time from
drm.rs, the L0 to L1 step and the L2 step on the next flight. Add the cumulativeperfin the status. Test: fake-clock unit tests. - Core and host. Add
create_themekind haze, with the core changes in 4.6. These are the schemarequiredand key list, theMANAGED_FILEregex, the v4build, andkindin the summary. Add the post-select check and the approval card text. Test: core tests, and the card in a browser with a synthetic core. - Built-in theme. Add
native/smithay/themes/hazeas a v4 theme, with kind haze, the default settings and the Studio shell layer. In a checkout, the folder reserves the slug. Add"haze"toFALLBACK_BUILT_IN(theme-create.js:23), and updateopenspec/specs/themes/spec.md:147. Test: the theme loads and passes the probe. Studio tests do not change. - Docs. Add a "Manifest v4: haze workspace transition" section to
openspec/specs/themes/spec.md. Add the budget, the ladder and the status "exploratory" toopenspec/specs/visual-effects-3d-shaders/spec.md. Update the create_theme section. Test: a review of the docs against the code. - Delivery and physical acceptance. Follow 8.5 and 8.7. Record the result, and only then change the status to validated.
10. Decisions
On 2026-11-01 the user accepted the recommended default of every open question:
- Look. The in-place dissolve with shimmer and mist, as this spec defines it.
- Delivery. A new built-in theme
haze. Studio does not change. - Duration. 280 ms by default, to confirm at the physical acceptance.
- Theme shaders. User themes may give their own
haze.frag, gated by the probe. Without the file, the built-in shader runs. - Interruption. A switch to a third workspace in mid-haze keeps the current one-frame snap in v1.
Appendix: approach selection
Three approaches were scored from 1 (worst) to 5 (best).
| Criterion | A: haze style on depth | B: v4 kind haze, two-plane composite | C: v4 kind haze, ladder, carry, half-res blur |
|---|---|---|---|
| Fit with rules and effect contract | 5 | 4 | 4 |
| Visual result for "haze" | 2 | 4 | 4 |
| Render cost on 2 outputs | 4 | 3 | 3 |
| Implementation size | 5 | 3 | 2 |
| Risk | 4 | 3 | 2 |
| Testability | 4 | 5 | 4 |
| Total | 24 | 22 | 19 |
A has the highest total, but B is the winner. A cannot show shimmer, motion or a dissolve, because its shader has no time, progress or second plane. Its symmetric alpha also lets the wallpaper show at the midpoint. So A does not give a real haze, and the visual result decides the choice.
Ideas taken from the other approaches:
- From C:
- the four-level fallback ladder;
- the budget guard and the
perfstatus; - the clear on lock;
- the optional theme shader with a built-in default.
- From A:
- Studio stays bit-identical, and a test proves it;
- the cost at rest stays zero.
- Changed from B: opaque planes that include the wallpaper. This removes the midpoint dip from A.
- Left out of v1: C's carry plane and half-resolution blur. They stay as later options, if the measurement in section 7 asks for them.