From 8c5e42230a8a97574d72201607d0b87a54a29f7a Mon Sep 17 00:00:00 2001 From: Breadway Date: Tue, 25 Aug 2026 00:21:14 +0800 Subject: [PATCH] shell: add spotlight builtin (theme 04), dots/placeholder-clock schema, and anim::spring_to - bread-theme::shell: WorkspacesModule.dot_widths and ClockModule.placeholder_clock, resolved/validated in manifest.rs and modeled in types.rs, so a theme can actually configure dot-pill widths and an entry-as-clock placeholder instead of those staying schema-only. - New compiled-in builtin "spotlight" (assets/shell/spotlight/), registered in builtin.rs so list() returns three themes: centred capsule window spec (anchors=[top] only, width=480, exclusive=none, keyboard=on_demand), workspaces.style=dots, clock.style=none+placeholder_clock, launcher.mode= embedded, drawer=[launcher_results]. Colours are palette token names (pink), never hex. - bread-theme::anim::spring_to: a reusable TickCallback size-interpolation helper (GTK4 has no CSS width/height transition on a widget or layer-shell surface), generalized from WorkspaceTrail's existing ease/tick pattern, for breadbar's capsule-drawer expand/collapse. - bread_launcher::LAUNCHER_APP: the launcher's one shared on-disk identity (cache/config/history), so breadbar's embedded capsule and breadbox's overlay window read and write the SAME cache and launch history rather than forking into two rankings of a user's apps. Tests: +6 spotlight builtin tests (loads/in list/capsule window shape/ embedded mode/dots widths/flat-pink-not-hex), bread-theme --lib 63->69, bread-launcher --lib unchanged at 18. --- bread-launcher/src/lib.rs | 25 ++- .../assets/shell/spotlight/spotlight.css | 73 +++++++ bread-theme/assets/shell/spotlight/theme.toml | 183 ++++++++++++++++++ bread-theme/src/anim.rs | 68 +++++++ bread-theme/src/lib.rs | 2 + bread-theme/src/shell/builtin.rs | 18 ++ bread-theme/src/shell/manifest.rs | 23 ++- bread-theme/src/shell/mod.rs | 97 ++++++++++ bread-theme/src/shell/types.rs | 18 ++ 9 files changed, 505 insertions(+), 2 deletions(-) create mode 100644 bread-theme/assets/shell/spotlight/spotlight.css create mode 100644 bread-theme/assets/shell/spotlight/theme.toml create mode 100644 bread-theme/src/anim.rs diff --git a/bread-launcher/src/lib.rs b/bread-launcher/src/lib.rs index 182900f..9f7fe31 100644 --- a/bread-launcher/src/lib.rs +++ b/bread-launcher/src/lib.rs @@ -9,7 +9,10 @@ //! //! Every path/cache/history entry point here takes an explicit `app: &str` //! rather than hardcoding an app name, so more than one host can use this -//! crate without colliding — see [`cache_dir`]/[`config_dir`]. +//! crate without colliding — see [`cache_dir`]/[`config_dir`]. [`LAUNCHER_APP`] +//! is the one identity every *launcher* host (as opposed to some unrelated +//! future consumer of `cache_dir`/`config_dir`) should actually pass — see +//! its own doc comment for why. mod desktop; mod history; @@ -27,3 +30,23 @@ pub use icon::IconCache; pub use launch::{do_launch, emit_launched}; pub use matching::{fuzzy_matches, fuzzy_score, load_sorted_entries, matches_term, priority_rank}; pub use paths::{app_dirs, cache_dir, config_dir, home_dir}; + +/// The launcher's one shared identity, passed to [`cache_dir`]/[`config_dir`]/ +/// [`IconCache::new`]/[`LaunchHistory::load`] by every host that embeds this +/// crate — breadbox's overlay window AND breadbar's embedded capsule +/// (theme 04/spotlight) alike. +/// +/// This is deliberate, not a leftover of breadbox being first: theme 04's +/// whole premise is that breadbar's capsule IS the launcher wearing a +/// different shell, not a second launcher with its own history +/// (`THEME_SYSTEM_PLAN.md` §7). If each host passed its own binary name here, +/// the same physical launcher would rank a user's apps differently +/// depending on which theme happened to be active — the icon cache and +/// "most launched" ordering would silently fork in two. Sharing this +/// constant is what keeps them one launcher. +/// +/// Do not pass a bare `"breadbox"` string literal at a call site instead of +/// this constant — that reads exactly like an unfixed bug (breadbar naming +/// another app's identity) and invites a later "fix" that would quietly +/// break the shared history this constant exists to guarantee. +pub const LAUNCHER_APP: &str = "breadbox"; diff --git a/bread-theme/assets/shell/spotlight/spotlight.css b/bread-theme/assets/shell/spotlight/spotlight.css new file mode 100644 index 0000000..2f35183 --- /dev/null +++ b/bread-theme/assets/shell/spotlight/spotlight.css @@ -0,0 +1,73 @@ +/* CSS template for the spotlight builtin (bread-theme/src/shell/builtin.rs). + * Same scope and substitution rules as liquid-motion.css/glass-workbench.css: + * only the window/workspace/clock chrome the manifest's own concepts model. + * + * NOTE (unlike its two siblings): breadbar does not actually call + * `ShellTheme::css()` today — its live stylesheet is the hand-written, + * token-driven `breadbar::theme::load_css()`, which is where the capsule's + * real chrome (dots, `.launcher-entry`, `.bread-drawer`/results rows) lives. + * This file exists so the manifest's own template mechanism stays exercised + * for all three builtins equally (and so a future `bread-theme` CLI/test + * that DOES call `.css()` sees a real spotlight template) — see + * `ShellTheme::css`'s own doc comment for why that gap between "what the + * manifest models" and "what breadbar actually renders" is pre-existing, + * not new to this file. + * + * Source: bos-ui-demos/04-spotlight.html's