You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: per-window themes via ambient render window
Let a user set a theme for one window without affecting others, persisted
across restart. The active theme stays global by default; a per-window
override is resolved during that window's render pass.
Mechanism: an ambient "current render window" thread-local in warpui_core,
set by the 3 render chokepoints (build_scene/render_view/render_views) via
an RAII guard. Appearance::theme()/ui_builder() consult it to resolve a
per-window override from new HashMaps, with a zero-cost is_empty() fast
path so the feature costs nothing when unused. (The plan called for setting
the ambient from Appearance directly in warpui_core, but warpui_core cannot
depend on warp_core/Appearance, so the ambient lives in warpui_core and
Appearance reads it.)
- Appearance: theme_overrides/ui_builder_overrides maps; set/clear_window_theme
invalidate only the target window.
- AppearanceManager: set/clear_window_theme; Workspace::on_window_closed clears
the override so maps don't leak.
- Theme chooser: "All windows"/"This window" scope toggle (default All);
"This window" routes to the per-window path and records the override on the
Workspace for persistence.
- Persistence: theme_override TEXT column (migration + schema + model), saved
via serde_json so ThemeKind::Custom round-trips, re-applied on window restore.
Verification: warp_core, warpui_core and persistence compile cleanly and a new
Appearance unit test covers override resolution + the fast path. The warp app
crate could not be built/tested in this environment (xcrun "metal" toolchain
unavailable; wasm fallback blocked by clang) -- run ./script/presubmit to
verify the app crate, clippy/fmt, and the new test.
(cherry picked from commit 80f5c59)
* fix: restore per-window theme override when theme preview is cancelled (#279)
revert_theme cleared the global transient preview but left a 'This window'
scope override in place, since per-window previews write straight into the
override map with no transient layer. Capture the window's override when the
chooser opens and restore (or clear) it on the revert path, mirroring
clear_transient_theme for the global preview.
Addresses zerx-lab review on PR #279. Could not full-build to verify (Metal
toolchain absent locally); change is type/borrow-checked against the API.
* fix(theme): keep_theme 同步 per-window override,避免重开主题选择器后丢失窗口主题
---------
Co-authored-by: zerx-lab <bot@zerx-lab.dev>
0 commit comments