hypr: drive urgent border via window tag

This commit is contained in:
2026-06-05 01:58:52 +02:00
parent 409cb5b808
commit 08c87390c3
@@ -139,20 +139,25 @@ hl.layer_rule({ match = { namespace = "quickshell:popout" }, animation = "bouncy
-- (xdg-activation) wears a red border until you look at it; focusing it consumes
-- the urgency and restores the normal violet-active / cyan-inactive pair. Glow is
-- global/active-only, so urgency rides on the border, not the glow.
--
-- `match` has no `address` key (it's a dispatcher selector, not a rule prop), so
-- a single tag-matched rule carries the colour and we toggle an `urgent` tag on
-- the window by address. Untagging drops the rule, reverting to the global
-- active/inactive pair automatically — no explicit reset needed.
local theme = require("theme")
local urgent_addrs = {}
hl.window_rule({ match = { tag = "urgent" }, border_color = theme.border_urgent })
hl.on("window.urgent", function(w)
if not (w and w.address) then return end
urgent_addrs[w.address] = true
hl.window_rule({ match = { address = w.address }, border_color = theme.border_urgent })
hl.dispatch(hl.dsp.window.tag({ tag = "+urgent", window = "address:" .. w.address }))
end)
hl.on("window.active", function(w)
if not (w and w.address) then return end
if not urgent_addrs[w.address] then return end
urgent_addrs[w.address] = nil
-- restore the active/inactive pair so no stale red lingers once it goes inactive again
hl.window_rule({ match = { address = w.address },
border_color = { theme.border_active, theme.border_inactive } })
hl.dispatch(hl.dsp.window.tag({ tag = "-urgent", window = "address:" .. w.address }))
end)