diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/handlers/mod.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 11553932..bfae2213 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -709,7 +709,12 @@ impl XdgActivationHandler for State { } fn token_created(&mut self, _token: XdgActivationToken, data: XdgActivationTokenData) -> bool { - // Only tokens that were created while the application has keyboard focus are valid. + // 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; }; @@ -717,6 +722,18 @@ impl XdgActivationHandler for State { return false; }; + // Widely-used clients such as Discord and Telegram make new tokens (with invalid serials) + // upon clicking on their tray icon or on their notification. This debug flag makes that + // work. + // + // Clicking on a notification sends clients a perfectly valid activation token from the + // notification daemon, but alas they ignore it. Maybe in the future the clients are fixed, + // and we can remove this debug flag. + let config = self.niri.config.borrow(); + if config.debug.honor_xdg_activation_with_invalid_serial { + return true; + } + // Check the serial against both a keyboard and a pointer, since layer-shell surfaces // with no keyboard interactivity won't have any keyboard focus. let kb_last_enter = seat.get_keyboard().unwrap().last_enter(); |
