Skip to content

gpui: Add runtime window visibility to snapshots - #3003

Open
domenkozar wants to merge 2 commits into
longbridge:mainfrom
domenkozar:gpui-window-visibility
Open

gpui: Add runtime window visibility to snapshots#3003
domenkozar wants to merge 2 commits into
longbridge:mainfrom
domenkozar:gpui-window-visibility

Conversation

@domenkozar

Copy link
Copy Markdown

Tray applications need to hide a window and restore the same view without closing it or rebuilding its state. This adds Window::set_visible(bool) to the GPUI snapshots, with implementations for macOS, Windows, X11, Wayland, web, and the headless/test platforms. Callers can explicitly activate the restored window when it should receive focus.

Since the platform sources live in Zed, this proposes carrying the implementation as a patch in the snapshot publisher. Staging checks every hunk before applying it, stops on upstream drift, marks modified source files, and records the patch in the snapshot metadata. The publishing verification also runs a regression test for initial visibility, repeated hide/show, and independence between windows. The patch README documents its origin, refresh/removal procedure, and the need for --force when releasing a patch-only change.

On Wayland, hiding unmaps the surface and suspends frame retries; restoring reapplies toplevel properties and waits for configuration before presenting. This includes a fix to the original implementation for hiding from inside a frame callback, which could otherwise keep scheduling retries.

Validation passed against both Zed 69164008341295ad481bb11c0334a712ca8c23e3 (gpui-pre 0.3.4) and db10a8dd733e64682638b98232c190e8babecd5a (current main when tested):

  • Snapshot staging and license audit.
  • cargo test -p gpui-pre --features test-support --test window_visibility in the staged workspace.
  • cargo check -p gpui-pre-platform --features x11,wayland in the staged workspace.
  • Publisher transformation self-test and patch application checks.

Native window-manager behavior on each desktop platform, the web implementation, and the full publish dry run still need validation. No crates were published.

@domenkozar
domenkozar marked this pull request as ready for review September 7, 2026 22:49
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.

1 participant