aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorDuncan Overbruck <mail@duncano.de>2025-03-21 17:31:27 +0100
committerIvan Molodetskikh <yalterz@gmail.com>2025-05-10 12:14:41 -0700
commit86f57c2ec775d4aa08bf310c94b22ea266eaa9e9 (patch)
tree1f5a81c4ffaec502cff856d2eb52a19e37f77bc4 /src/handlers
parent3cc67897afeabe6e0b1a6d035fde6f81010372d1 (diff)
downloadniri-86f57c2ec775d4aa08bf310c94b22ea266eaa9e9.tar.gz
niri-86f57c2ec775d4aa08bf310c94b22ea266eaa9e9.tar.bz2
niri-86f57c2ec775d4aa08bf310c94b22ea266eaa9e9.zip
add window urgency through xdg-activation-v1
urgency is done through activation requests without a serial from a previous interaction. https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/150
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/mod.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index f2613d19..ffbf2439 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -707,6 +707,8 @@ impl GammaControlHandler for State {
}
delegate_gamma_control!(State);
+struct UrgentOnlyMarker;
+
impl XdgActivationHandler for State {
fn activation_state(&mut self) -> &mut XdgActivationState {
&mut self.niri.activation_state
@@ -716,11 +718,10 @@ impl XdgActivationHandler for State {
// Tokens without a serial are urgency-only. This is not specified, but it seems to be the
// common client behavior.
//
- // We don't have urgency yet, so just ignore such tokens.
- //
// See also: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/150
let Some((serial, seat)) = data.serial else {
- return false;
+ data.user_data.insert_if_missing(|| UrgentOnlyMarker);
+ return true;
};
let Some(seat) = Seat::<State>::from_resource(&seat) else {
return false;
@@ -760,11 +761,16 @@ impl XdgActivationHandler for State {
surface: WlSurface,
) {
if token_data.timestamp.elapsed() < XDG_ACTIVATION_TOKEN_TIMEOUT {
- if let Some((mapped, _)) = self.niri.layout.find_window_and_output(&surface) {
+ if let Some((mapped, _)) = self.niri.layout.find_window_and_output_mut(&surface) {
let window = mapped.window.clone();
- self.niri.layout.activate_window(&window);
- self.niri.layer_shell_on_demand_focus = None;
- self.niri.queue_redraw_all();
+ if token_data.user_data.get::<UrgentOnlyMarker>().is_some() {
+ mapped.set_urgent(true);
+ self.niri.queue_redraw_all();
+ } else {
+ self.niri.layout.activate_window(&window);
+ self.niri.layer_shell_on_demand_focus = None;
+ self.niri.queue_redraw_all();
+ }
} else if let Some(unmapped) = self.niri.unmapped_windows.get_mut(&surface) {
unmapped.activation_token_data = Some(token_data);
}