Commit graph

5 commits

Author SHA1 Message Date
Breadway
470d2aa7e9 bread-launcher: log history save failures, clarify LAUNCHER_APP vs event namespace
LaunchHistory::save silently swallowed write errors; now shared by two
hosts (breadbox + breadbar's capsule), a broken cache dir silently
stopped recording launches for both. Log on failure instead.

do_launch/emit_launched's app_id parameter is the caller's bread
event-namespace id (breadbox passes "box"), not LAUNCHER_APP
("breadbox", scoped to cache/history paths only) - two similarly
named but distinct identities. Make the doc comments say so explicitly
and add tests pinning the exact namespace-check relationship, since
confusing them silently drops the emitted event.
2026-08-31 15:15:36 +08:00
Breadway
3326207d34 bread-launcher: fix UTF-8 panic in whole-word matching
matches_term advanced its scan with start = i + 1 — one byte past the START
of a failed match rather than past the whole match. Both i and i + tlen are
guaranteed char boundaries; i + 1 is not, so a multi-byte term that failed
the word-boundary check left start inside a character and the following
field[start..] slice panicked.

matches_term("café", "é") reproduces it: byte index 4 is not a char
boundary. The path is reached from priority_rank over real .desktop Name=
values, so any non-ASCII application name could crash the launcher's sort —
never hit locally because every installed app here happens to be ASCII.
2026-08-31 15:15:36 +08:00
Breadway
00e8d4f28e bread-launcher: implement query modes and result sections (phase 6c)
New query module: parse_query splits a leading =/>/. into calc/cmd/url
(falling through to a literal apps query otherwise), eval_calc is a small
four-function arithmetic evaluator matching the demo's evalCalc semantics
(bad expr/err/∞ included), and builtin_commands/filter_commands cover the
> palette. matching::split_sections groups already-sorted entries into
recent/apps using LaunchHistory's existing counts, no new tracking.

ResultsList::new takes a new `sections` bool: true builds non-selectable
"Recent"/"Apps" header rows (build_header_row) ahead of their groups,
visible only in the idle empty-query view; set_query/select_next/
select_prev all learned to treat a header row (no DesktopEntry data) as
never-selectable. breadbox passes sections=false to keep its own overlay
exactly as it was.
2026-08-31 15:14:44 +08:00
Breadway
8c5e42230a shell: add spotlight builtin (theme 04), dots/placeholder-clock schema, and anim::spring_to
- bread-theme:🐚 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.
2026-08-31 15:14:44 +08:00
Breadway
6ffd689a4d Add bread-launcher: headless app-launcher core + GTK4 results widget
Extracts the app-launcher substance (desktop-entry parsing, fuzzy
matching/ranking, launch history, launching) out of breadbox into a
reusable ecosystem crate, so breadbar's future embedded capsule and
breadbox's overlay window can share one implementation instead of two
(THEME_SYSTEM_PLAN.md Phase 4/6a). The GTK4 results-list widget lives
behind a `gtk` feature, mirroring bread-theme's `gtk`/`adw` gating, so a
headless consumer isn't forced to link GTK.

Adds unit tests for fuzzy_score/matches_term/priority_rank, which were
previously untested pure functions inside breadbox's main.rs.
2026-08-31 15:14:44 +08:00