Namespace Hyprland events under bread.hyprland.*, keep legacy names via [compat]

normalize_hyprland() dual-emits each of its 10 flat event names
(bread.workspace.changed, bread.monitor.connected, bread.window.opened,
etc.) alongside a bread.hyprland.<rest> equivalent, so portable automation
can subscribe to bread.hyprland.* and be guaranteed compositor-specific
coverage without also matching genuinely cross-backend events like
bread.power.*. The bread.hyprland.event fallback was already namespaced
and is unaffected.

Gated behind [compat] legacy_hyprland_event_names (default true during
the deprecation window) so the old names keep firing until modules
migrate; set to false to emit only the namespaced names.
EventNormalizer::with_legacy_hyprland_event_names(bool) is a builder on
top of the existing ::new(dedup_window_ms), threaded through from config
in main.rs.

Bumps API_VERSION to 1.5.0 (additive), updates Documentation.md's
Hyprland event reference with Deprecated/Since markers and the new
[compat] option, refreshes the README config example and the
dock-workflow/git-branch-widget examples to the namespaced names, and
adds DEPRECATIONS.md tracking the deferred full removal once the window
closes.
This commit is contained in:
Breadway 2026-08-04 22:08:44 +08:00
parent 96639516b1
commit d270ac6ff7
9 changed files with 535 additions and 95 deletions

View file

@ -21,7 +21,7 @@ bread.workflow.define("dock-connected", function()
bread.workflow.step("waiting for monitor")
local event = bread.wait_any(
{ "bread.monitor.connected", "bread.hyprland.event" },
{ "bread.hyprland.monitor.connected", "bread.hyprland.event" },
{ timeout = 5000 }
)
if not event then
@ -35,7 +35,7 @@ bread.workflow.define("dock-connected", function()
bread.profile.activate("docked")
bread.workflow.step("waiting for workspace")
bread.wait("bread.workspace.changed", { timeout = 3000 })
bread.wait("bread.hyprland.workspace.changed", { timeout = 3000 })
bread.workflow.step("notifying")
bread.notify("Dock connected", { title = "bread" })

View file

@ -146,8 +146,8 @@ function M.on_load()
-- catch a branch switch inside the same still-focused tab (e.g. `git
-- checkout` run without ever changing window focus), which produces no
-- focus event at all.
bread.on("bread.window.focused", update)
bread.on("bread.window.focus.changed", update)
bread.on("bread.hyprland.window.focused", update)
bread.on("bread.hyprland.window.focus.changed", update)
bread.every(2000, update)
end