foreign-toplevel-management: add urgency hint
The motivation comes from labwc's issue.
In KDE, when a user opens a URL with xdg-open
and there's already an existing browser window, the focused window remains unchanged. Instead, the panel item for the browser turns orange, indicating it needs attention. Allowing wlroots panels (e.g. Waybar and sfwbar) to implement similar behavior would be beneficial.
Sway shows urgency hints by changing titlebar color to red, which might be sufficient for it. However, for many Wayland compositors that allow window minimization, the panel item is the best place to show urgency hints in my opinion.
Possible solutions include:
- Adding
needs_attention
to thestate
enum. - Adding
needs_attention
event to thezwlr_foreign_toplevel_handle_v1
interface.
While (1.) looks natural and will work seamlessly with XWayland windows, (2.) allows panel clients to decide when to drop the urgent state (typically when the urgent window is activated), slightly simplifying the compositor's task. In addition, I think needs_attention
doesn't need corresponding set_needs_attention
request, so it's a bit different from existing minimized
/maximized
/activated
/fullscreen
states.
If we choose (1.), it will also be worth considering adding always_on_top
/always_on_bottom
/sticky
/shaded
states too (suggested here).