aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-02-26 19:24:37 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-02-26 19:33:58 +0300
commit693d9355386c6217bb9cca5cb30c2b4248f19d8c (patch)
treef7c7f683f417ce624518a2913ae6da97d70a63bb /src
parent16405b9b2b99edaf9388df6a7228ca07f110769d (diff)
downloadniri-693d9355386c6217bb9cca5cb30c2b4248f19d8c.tar.gz
niri-693d9355386c6217bb9cca5cb30c2b4248f19d8c.tar.bz2
niri-693d9355386c6217bb9cca5cb30c2b4248f19d8c.zip
Add honor-xdg-activation-with-invalid-serial debug flag
Diffstat (limited to 'src')
-rw-r--r--src/handlers/mod.rs19
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();