Galaxy Shell / docs

Black-hole window closing

openspec/specs/black-hole-close/spec.md · Edit on GitHub ↗

On this page

Black-hole window closing

Purpose

With the black-hole wallpaper, closing an application shows the window sucked into the hole. This spec indexes the limits and trust boundaries of that compositor-owned close effect.

Requirements

Requirement: Visual starts only on real destruction

The 400 ms visual (150 to 1000 ms by the motion timing) SHALL never delay or substitute a normal client close. A close request alone MUST do nothing, and only actual toplevel destruction SHALL start the visual. Full text: section Introduction.

Scenario: Visual starts only on real destruction

  • WHEN a client shows an unsaved-work dialog after a close request
  • THEN the visual does not start

Requirement: Snapshot budget and privacy

The compositor SHALL keep up to eight visible application snapshots across all outputs, each at most 1024x768, refreshed at most 10 times a second. There SHALL be no CPU readback, PNG, disk file, client buffer retention after destruction or model-visible pixels. Full text: section Drawing and lifetime.

Scenario: Snapshot budget and privacy

  • WHEN snapshots are refreshed
  • THEN they refresh at most 10 times a second

Requirement: Where the flight draws

After destruction the real window is already removed and receives no input. The snapshot SHALL be below the protected shell and above application windows, and the flight releases its cache entry when it ends. Full text: section Drawing and lifetime.

Scenario: Where the flight draws

  • WHEN a window is destroyed
  • THEN its snapshot flies to the hole while the real window receives no input

Requirement: Cases with no flight

Minimize and hiding a live window MUST NOT start a flight, and shell windows and dialogs are excluded. Above the budget or on GPU failure, windows close normally. Full text: section Drawing and lifetime.

Scenario: Cases with no flight

  • WHEN a live window is minimized
  • THEN no flight starts

Requirement: Cache cleared on context change

Workspace or output changes, lock, overview, workspace transitions, reduced motion and the Canvas lens SHALL clear the cache instead of showing a stale image in a different context. Full text: section Drawing and lifetime.

Scenario: Cache cleared on context change

  • WHEN the session locks
  • THEN the snapshot cache is cleared

Requirement: A theme close pass wins over the built-in close

While the wallpaper reports a live sink, a theme window-close pass SHALL draw the close, at the placement that the sink gives it, and the built-in close MUST draw only when the active theme has no close pass (owner decision of 2026-11-13, "O tema vence"). Full text: section Drawing and lifetime.

Scenario: A theme close pass wins over the built-in close

  • WHEN the wallpaper reports a live sink and a theme defines a window-close pass
  • THEN the theme pass draws and the built-in close does not

Scenario: A theme with no close pass

  • WHEN the wallpaper reports a live sink and the active theme has no window-close pass
  • THEN the built-in close draws

Requirement: Sink endpoint is narrow

POST /desktop-wallpaper/sink SHALL accept at most 128 bytes and exactly {x, y} with finite fractions from 0 to 1, and SHALL require the launch cookie and the exact core Origin. No shell token, agent tool, MCP action, generated HTML or plugin panel gains access. Full text: section Synchronizing the destination.

Scenario: Sink endpoint is narrow

  • WHEN a body has extra keys or is above 128 bytes
  • THEN it does not match the endpoint contract

Requirement: Report cadence and forwarding gate

Only a black-hole frame SHALL send a report, at most 10 Hz with at most one request in flight. The core SHALL forward the point only while the effect is black-hole and the compositor is connected, unlocked and outside overview, and send wallpaper_sink only after capabilities.wallpaperSink is reported. Full text: section Synchronizing the destination.

Scenario: Report cadence and forwarding gate

  • WHEN the page is hidden or reduced motion is on
  • THEN no heartbeat is sent

Requirement: Sink command expires

The wallpaper_sink command SHALL accept a bounded target or null and expire after 650 ms without a report; switching away clears it. Expiry discards snapshots and MUST NOT freeze a closing image indefinitely, and no arbitrary window action is part of the command. Full text: section Synchronizing the destination.

Scenario: Sink command expires

  • WHEN 650 ms pass without a report
  • THEN the command expires and the snapshots are discarded

Requirement: Activation and compatibility

The new core SHALL skip the command on an older compositor and the old core never arms it on a newer one. Without a live renderer heartbeat nothing is cached or animated, and the reduced-motion command is authoritative. There is no extra user setting. Full text: section Compatibility and activation.

Scenario: Activation and compatibility

  • WHEN there is no live renderer heartbeat
  • THEN nothing is cached or animated

Status

Doc status: current contract. Checked 2026-11-10.

Introduction

On 2026-11-04 the owner requested that closing an application while the black-hole wallpaper is selected should look like the window being sucked into the hole. The visual lasts 400 ms by default (since 2026-11-10 the motion timing of the core can set 150 to 1000 ms, motion-timing.md) and never delays or substitutes a normal client close. A close request alone does nothing: a client may show an unsaved-work dialog or refuse the request. Only actual toplevel destruction starts the visual.

Drawing and lifetime

native/smithay/src/black_hole.rs uses the existing GPU downscale cache to keep up to eight visible application snapshots across all outputs, each at most 1024x768 (24 MiB of RGBA textures total, excluding driver overhead). Snapshots refresh on content/size changes at most 10 times a second. The last image can therefore be up to about 100 ms old. Opening reveal is omitted from the snapshot; rounded corners and window finish remain. No CPU readback, PNG, disk file, client buffer retention after destruction, or model-visible pixels.

After destruction, the snapshot follows an accelerating curved path, shrinks, and bends through a texture shader before disappearing at the hole. The real window is already removed and receives no input. The snapshot is below the protected shell and above application windows. The flight retains the same cache entry and releases it when its flight ends (400 ms by default); it allocates no extra snapshot. Minimize and hiding a live window do not start a flight. Shell windows and dialogs are excluded. Workspace/output changes, lock, overview, workspace transitions, reduced motion and the Canvas lens clear the cache instead of showing a stale image in a different context. Above the budget or on GPU failure, windows close normally.

Since 2026-11-09 the wgpu renderer draws the same effect through native/smithay/src/plain_black_hole.rs, with its own snapshot list, the same decisions (sink, track and flights in black_hole.rs) and the same bend (native/wgpu-renderer/src/effects/black-hole-core.wgsl); see wgpu-renderer-plan.md, Phase 3 step 4.

Since 2026-11-10 a theme can define a window-close pass (openspec/specs/themes/spec.md, Manifest v4) that reuses this snapshot cache and bookkeeping. Until 2026-11-13, while the wallpaper reported a live sink, this built-in close kept the close and the theme pass did not draw (history). Since 2026-11-13 the theme wins (owner decision, "O tema vence"): the pass of the active theme draws while the sink is live, at the placement that its reserved --sink and --sink-curve give it toward the sink (none moves it toward the sink, so it draws in place), for its own duration; this built-in close draws only when the active theme has no close pass. The black hole stays the wallpaper. The same close also exists as a package, native/smithay/effects/black-hole-close, with the reserved parameters --sink and --sink-curve. Offscreen it draws within 1 px of this built-in flight (openspec/specs/window-effect-slots/spec.md, phase 4); a theme that lists it as its close pass reaches the sink in the product. The package has the 400 ms of its CSS, so it matches the built-in close only at the default closeMs; the motion timing never changes a theme pass (openspec/changes/window-effect-slots/design.md, Parameters and time).

Synchronizing the destination

The trusted wallpaper renderer reports only the center it actually drew, including its bounded pointer easing. POST /desktop-wallpaper/sink accepts at most 128 bytes and exactly {x, y} with finite fractions from 0 to 1. It requires the launch cookie and the exact core Origin. The wallpaper partition's request allowlist and CSP add only this exact endpoint. The existing events stream remains read-only. No shell token, agent tool, MCP action, generated HTML or plugin panel gains access. Other authenticated pages hold the same cookie; this is a narrow trusted-renderer report, not a new authentication boundary.

Only a black-hole frame sends a report, at most 10 Hz and with at most one request in flight. A PNG, reduced motion, a hidden page or a WebGL failure produces no heartbeat. The core forwards the point only while the effect is black-hole and the compositor is connected, unlocked and outside overview. It sends wallpaper_sink only after capabilities.wallpaperSink is reported. The control-only command accepts a bounded target or null and expires after 650 ms without a report. Switching away clears it. Expiry discards snapshots; it never freezes a closing image indefinitely. No arbitrary window action is part of this command. As with existing maintenance tools, these boundaries are advisory against an authenticated agent executing arbitrary user code.

The primary output uses the reported point directly; other outputs transform it through the same aspect-preserving wallpaper cover placement. The wallpaper still mirrors one image on every output. Flights follow subsequent reports, so moving the mouse during a close keeps the destination on the drawn hole. Reports and display frames are asynchronous: synchronization is within the 100 ms report cadence plus transport/frame time, not a cross-process atomic frame guarantee.

Compatibility and activation

The new core skips the command on an older compositor; the old core never arms it on a newer compositor. Without a live renderer heartbeat, nothing is cached or animated. The existing reduced-motion command is authoritative. There is no extra user setting. Core, wallpaper bundle and compositor must be prepared together; a new login activates the compositor. Do not restart the live compositor to apply the feature. Rollback is a git revert and a prepared next login. No profile/history migration is required.

API reference: the installed Smithay 0.7.0 Rustdoc/source for backend::renderer::element::texture::TextureRenderBuffer and gles::element::TextureShaderElement, and the existing production sharp_zoom.rs / window_finish.rs patterns (as of the implementation; the GLES TextureShaderElement close was removed on 2026-11-11, step 7 of openspec/changes/archive/2026-11-10-gles-removal-plan/design.md, and the plain scene of the wgpu renderer draws it: plain_black_hole.rs). Context was unavailable and the versioned docs.rs pages were inaccessible during implementation; the locked crate sources were inspected directly and compile/GPU tests validate usage.

Validation (2026-11-04)

  • Node: 1,291 tests passed; syntax, ESLint, build consistency and Prettier passed.
  • Rust: 766 passed, 51 opt-in GPU tests ignored by the general run; the five black-hole tests were run explicitly with --include-ignored and passed, including actual Wayland destruction with the production EGL scene. Rustfmt and Clippy with -D warnings passed.
  • Browser: wallpaper suite passed, including center reports within the reduced pointer excursion with a frozen scene clock, existing CSP isolation and reduced motion.
  • Nested run d9b23e3b: selected Buraco negro through Appearance, launched a synthetic Zenity window, closed it with Super+Q and captured the shrinking, curved image and its complete disappearance. The destroyed application was absent from the final compositor state. Run stopped afterward. Evidence: before.png, during.png, after.png, kept locally outside Git. No video, upload, provider usage or live-session restart.

The nested run uses one output and software rendering. It does not establish physical-GPU performance or a visual proof on multiple monitors. The pointer and cover math follow the existing shared wallpaper coordinate contract.