Galaxy Shell / docs
Docs / Interface and features

Motion timing

openspec/specs/motion-timing/spec.md · Edit on GitHub ↗

On this page

Motion timing

Purpose

Moves the camera flight and black-hole close timing from Rust constants to data the core sends, with bounds and a lease so the compositor returns to its defaults when the core is gone.

Requirements

Requirement: Defaults and bounds

The compositor SHALL start with the defaults cameraMs 300, cameraEasing [0.22, 1, 0.36, 1] and closeMs 400, pinned in web-shell/test/fixtures/motion-timing-defaults.json. cameraMs is 80 to 1500 ms, closeMs 150 to 1000 ms, and easing values are finite and in [0, 1]. Full text: section What it does.

Scenario: Default camera flight

  • WHEN no timing was sent
  • THEN a camera flight takes 300 ms

Requirement: An out-of-bounds value refuses the whole command

Each field of the motion_timing command SHALL be optional and an omitted field takes its default, so a command replaces the whole timing. A value out of bounds refuses the whole command and keeps the timing in force. Full text: section Rules.

Scenario: closeMs 5000

  • WHEN a command sets close_ms to 5000
  • THEN the command is refused and the timing stays

Requirement: Locked and connection rules

The compositor SHALL refuse the command while the session is locked, only the control connection takes it, and the core sends nothing while locked, while a request is pending, or when the reported timing already matches. Full text: section Rules.

Scenario: Host connection sends it

  • WHEN the host connection sends motion_timing
  • THEN it gets the control connection message

Requirement: A running flight never jumps

A flight SHALL copy the timing in force when it starts, so a new timing never makes a running camera or close jump. Full text: section Rules.

Scenario: Timing changes mid-flight

  • WHEN a new timing arrives during a flight
  • THEN the running flight keeps its copy

Requirement: Reduced motion and theme close are unchanged

workspace_motion SHALL stay the only reduced motion switch (with it the camera moves at once), and closeMs sets only the built-in black-hole close: a theme window-close pass keeps the duration of its own CSS. The wallpaper page never sees the close duration. Full text: section Rules.

Scenario: Reduced motion

  • WHEN workspace_motion is reduced
  • THEN the camera still moves at once, whatever the timing

Requirement: The timing is a lease

An accepted command SHALL take a lease for its control connection and a refused one does not; when the last connection that sent the timing closes, the compositor waits the 60 s grace time and goes back to the defaults. A non-default timing goes out once on each new connection, and nothing goes out while locked. Full text: section When the core goes away.

Scenario: Core gone

  • WHEN the last connection that sent the timing closes
  • THEN after 60 s the defaults return and running flights keep their timing

Requirement: Only the core and host reach the timing

Only the core and the Electron host SHALL reach the control socket; no agent tool, MCP entry, scheduled turn, generated HTML or plugin panel reaches the timing, the command or setMotionTiming. Full text: section Authority.

Scenario: Agent tool tries it

  • WHEN an agent tool tries to set the timing
  • THEN it cannot reach it

Status

Doc status: partly landed. Landed: camera and close timing as data from the core, with a lease (2026-11-10). Not landed: an editor, the other timings, a live check. Checked 2026-11-10.

What it does

Two compositor animations that no theme package covers take their timing from data that the core sends with the command motion_timing (capabilities.motionTiming), instead of Rust constants. The compositor (native/smithay/src/motion_timing.rs) starts with the defaults below and reports the timing in force as motionTiming in the state snapshot. The core (web-shell/core/motion-timing.js, Smithay.setMotionTiming) holds its own copy and syncMotionTiming sends it while the compositor reports another value, the pattern of hot-corners.md. The defaults are pinned in web-shell/test/fixtures/motion-timing-defaults.json, which a Rust test and a core test both read.

Field Animation Default Bounds
cameraMs Camera flights of a canvas: fits, snaps, keyboard zoom (canvas-windows.md, Animation) 300 ms 80 to 1500 ms
cameraEasing Their curve, a cubic-bezier [x1, y1, x2, y2] [0.22, 1, 0.36, 1] each value finite and in [0, 1]
closeMs The black-hole close (black-hole-close.md) 400 ms 150 to 1000 ms

Rules

  • The command is {"action": "motion_timing", "camera_ms": 300, "camera_easing": [0.22, 1, 0.36, 1], "close_ms": 400}. Each field is optional and an omitted field takes its default, so a command replaces the whole timing. A value out of bounds refuses the whole command and keeps the timing in force. The compositor refuses it while the session is locked, only the control connection takes it (the host connection gets "The motion timing needs the control connection"), and the core sends nothing while locked, while a request is pending, or when the reported timing already matches.
  • A flight copies the timing in force when it starts, so a new timing never makes a running camera or close jump.
  • workspace_motion stays the only reduced motion switch: with reduced motion the camera still moves at once, whatever the timing.
  • The bounds of the camera are those of the workspace transition theme (crate::workspace_theme::Settings), which already had its own timing in the theme package and does not change here. In the same way closeMs sets only the built-in black-hole close: a theme window-close pass keeps the duration of its own CSS (openspec/changes/window-effect-slots/design.md, Parameters and time). With easing values in [0, 1] the x of the curve grows with t, so the bisection of the easing stays valid; a curve with overshoot is not possible.
  • The upper bound of the close follows the wallpaper sink: the wallpaper page reports the center about every 100 ms and each report renews the 650 ms lease of the target (black_hole::LEASE), so a close of up to one second stays fed. A page that stops reporting for 650 ms ends the effect, as before. The page never sees the close duration.

When the core goes away

The command is a lease, the pattern of visual_style (crate::canvas::Lease, Compositor::motion_timing_lease). An accepted command takes it for its control connection; a refused one does not. When the last connection that sent the timing closes, the compositor waits the 60 s of crate::canvas::GRACE and then goes back to the defaults. The release runs through the shared control_connection_closed, and the core keeps the timing in a ControlLease (web-shell/core/control-lease.js) that sends a timing other than the default once on each new connection, so a core restart within it renews the lease and nothing flips (nothing goes out while locked), and a rollback to a core that never sends it returns the defaults after 60 s. Flights that run keep the timing they copied.

Authority

Only the core and the Electron host reach the control socket. No agent tool, MCP entry, scheduled turn, generated HTML or plugin panel reaches the timing, the command or setMotionTiming.