Emit bread.box.launched after a successful app launch
All checks were successful
check / check (push) Successful in 16s
dev release / build (push) Successful in 33s

Link bread-utils bread-client (tag v0.7.1) from the breadbox crate.
Fire-and-forget via BreadClient; silent if breadd is down. No command
verbs — breadbox is not a daemon. EVENTS.md is the contract (app id box).
This commit is contained in:
Breadway 2026-08-15 22:14:42 +08:00
parent e5ce91a9c9
commit 1b02cec0a6
6 changed files with 93 additions and 7 deletions

41
EVENTS.md Normal file
View file

@ -0,0 +1,41 @@
# breadbox — bread event integration
breadbox is a standalone app launcher: it works exactly the same with or
without `breadd` running. When breadd *is* present, the GTK launcher
publishes a single event into the shared bread automation fabric after a
successful launch. See the parent `bread` repo's `Documentation.md`
specifically its "Namespaces" and "Integrating a bread\* app" sections —
for the general convention this follows.
App id: **`box`**. Transport: `bread-utils`'s `bread_client` module
(feature `bread-client`) — `breadbox` links it directly. breadbox is a
short-lived process (it exits when the launcher closes), so each `emit`
is its own short-lived connection. There is no long-running daemon and
therefore no command subscription.
## Events published (`bread.box.*`)
| Event | Data | When |
|-------|------|------|
| `bread.box.launched` | `{ "id": "<desktop id or exec>", "name": "<display name>" }` | The user launched an app (Enter / keypad Enter on the selected row, or activating a row) **and** the spawn succeeded. Not emitted if `Command::spawn` fails (missing terminal, `exec` that cannot start). `id` is the desktop-file id (the `.desktop` filename, e.g. `firefox.desktop`), falling back to the stripped `Exec=` line when that id is empty. `name` is the desktop-entry display name. |
Launch history is local to breadbox (`~/.cache/breadbox/history.json`);
the event bus is a notification that a launch happened, not a channel
for the exec line's arguments or the resulting process.
## Commands honored (`bread.command.box.*`)
None. breadbox is not a daemon — it is not running (and not subscribed)
except while the launcher overlay is open. There is no existing
"launch this desktop id from the bus" product surface, and inventing
`bread.command.box.launch` (or similar) without that surface would be a
stub. If/when breadbox grows a long-running piece that can honor a
verb, the corresponding `bread.command.box.*` command should be added
at the same time, not stubbed out ahead of it.
## Fail-safe behavior
- If breadd isn't installed or isn't running, `emit` is a silent no-op
(`BreadClient::emit` never blocks or errors the caller) — launching,
history, theming, and the singleton toggle are entirely unaffected.
- Closing the launcher without launching anything emits nothing.