Skip to content

fix(linux): honor desktop Reduce Motion - #34

Merged
melonamin merged 1 commit into
melonamin:linux-portfrom
MemberIT:fix/linux-reduce-motion
Sep 1, 2026
Merged

melonamin merged 1 commit into
melonamin:linux-portfrom
MemberIT:fix/linux-reduce-motion

Conversation

@MemberIT

Copy link
Copy Markdown

What

The Linux frontend always runs the CSS pulse attached to an agent-status glyph requested with session.status --blink, even when the desktop asks applications to reduce or disable animation.

This PR closes parity-audit gap Б5: Reduce Motion. It reads GTK's dedicated gtk-interface-reduced-motion preference when available (GTK 4.22+) and retains gtk-enable-animations as the fallback used by the currently supported GTK 4.14 stack. Either preference replaces the decorative pulse with animation: none; the status glyph, color, tooltip, control state, and read-back remain unchanged.

The app CSS provider is now reloadable. Changes to either GTK setting take effect immediately on every existing status glyph without restarting agterm or rebuilding widgets.

Cause

agterm-linux/Sources/AgtermLinux/App.swift installed one unconditional rule:

.agterm-blink { animation: agterm-blink-pulse 1.2s ease-in-out infinite; }

The only observed GtkSettings properties were sidebar metrics (gtk-xft-dpi, gtk-font-name, and gtk-overlay-scrolling). No code read gtk-interface-reduced-motion or gtk-enable-animations, and no callback could reload the CSS when either desktop preference changed.

This confirms the audit finding directly in the current linux-port source: a caller-set blink always pulsed, independent of the desktop accessibility preference.

Minimal reproduction

  1. Set an active status with a pulse, for example agtermctl session status active --blink --target <session>.
  2. Disable desktop animations (on the supported GTK 4.14 runtime this reaches GtkSettings:gtk-enable-animations; GTK 4.22+ also exposes the dedicated reduced-motion preference).
  3. Observe the status glyph.

Expected: the glyph remains visible and stops pulsing while reduced motion is requested. Actual before this PR: .agterm-blink continues its infinite opacity animation.

Change

Commit fix(linux): honor desktop reduce motion:

  • Sources/AgtermLinux/LinuxReduceMotionPolicy.swift — resolves the dedicated GTK preference plus the legacy animation switch and produces the one gated blink rule.
  • Sources/CGtk/shim.h — adds typed, property-existence-checked GObject readers. This avoids querying the GTK 4.22-only enum on GTK 4.14 and avoids hard-coding a future enum GType in Swift.
  • Sources/AgtermLinux/App.swift — keeps the app-wide CSS provider, reloads it on both relevant GtkSettings notifications, and composes the blink rule from the resolved preference. Existing labels update through the shared provider; there is no widget traversal, polling, timer, or per-glyph state.
  • Tests/AgtermLinuxTests/LinuxReduceMotionPolicyTests.swift — covers the dedicated preference, the legacy fallback, normal motion, and the exact composed CSS for both states.
  • Tests/AgtermLinuxTests/LinuxPolicyTests.swift — keeps the existing composed-CSS integration pin against the new function shape.
  • README.md — documents Linux Reduce Motion behavior and the visible-glyph invariant.

No agtermCore change: GTK preference discovery, CSS policy, and provider reload stay inside the Linux target.

Scope note

Decorative agent-status pulse only. The AgentIndicator.blink model and control protocol remain intact, so tree and event read-back still report the caller's requested blink state even while the desktop suppresses its animation. Re-enabling motion restores the pulse without requiring another control command.

Terminal rendering, libghostty animation, GTK/libadwaita native transitions, persisted settings, the keymap, and the window/workspace/session/pane model are unchanged.

Keep-in-sync

Control API exempt: this is accessibility rendering of the existing session.status --blink capability, not a new user action or mutable setting. The caller's requested state and existing read-back remain unchanged.

The keymap format, control catalog, window/workspace/session/pane model, and bundled agent skill are unchanged, so no plugin or command-reference update is required. README.md carries the user-visible Linux behavior. CHANGELOG.md is intentionally unchanged outside release flow.

Testing

All verification ran inside a purpose-built Docker image based on swift:6.3.2-noble; no tests or builds were run on the host. The image installed GTK4/libadwaita development packages, libepoxy, software GL, AT-SPI/Xvfb/Openbox, zsh, Zig 0.16.0, and SwiftLint 0.65.0, then built the pinned vendored libghostty through scripts/setup-linux.sh.

  • swift test in agterm-linux: 336 tests / 48 suites passed, including all four new Reduce Motion policy/CSS tests.
  • swift test in agtermCore: 2570 tests / 97 suites passed.
  • swiftlint lint --strict --quiet: clean.
  • scripts/check-linux-core-boundary.sh 834b74a7f78de06e1c4f66c5e24eafccd047ec64: passed.
  • scripts/check-linux-cli-drift.sh: passed.
  • scripts/test-linux-architecture.sh: passed.
  • swift build: passed.
  • swift build -c release: passed.
  • scripts/test-linux-ui.sh: all GTK AT-SPI scenarios passed, including the app-CSS parser guard on Ubuntu 24.04's GTK 4.14.5.
  • git diff --check: clean.

The focused behavioral contract is RED → GREEN coverage: reduced motion or disabled animations emits .agterm-blink { animation: none; }; normal preferences retain the existing agterm-blink-pulse rule. The full GTK smoke confirms the resulting stylesheet parses and the application surface remains healthy on the oldest supported GTK runtime.

@MemberIT
MemberIT requested a review from melonamin as a code owner August 28, 2026 12:57
@melonamin
melonamin merged commit fe886b7 into melonamin:linux-port Sep 1, 2026
5 checks passed
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