Allow Xwayland application keylogging
Feature summary
Due to how Wayland works, it blocks applications from viewing keypresses when not focused (without root access). However, in X11 this functionality was typically expected, so Xwayland applications work just fine to spy on each other but not on native Wayland windows.
In xdg-desktop-portal v1.16 a global keybinds portal [1] was added to allow applications to function as normal on Wayland (like soundboards, push-to-talk, etc). However, many applications that end users use normally are likely to not implement this functionality such as Discord, as they might be proprietary and refuse to put in the effort to properly support the Linux desktop.
KDE handles this by allowing Xwayland windows to view all Wayland key events if the end user specifically allows this, with options [2]. GNOME might be able to take from how KDE does it.
How would you like it to work
- Settings has options for Xwayland keylogging beside the appropriate portal for the feature [3]
- Mutter allows Xwayland applications to keylog if the end user specifically allows it, with similar options as KDE has:
- Never
- Only specific keys
- All keys but only when specific keys are pressed
- Always
Alternatively, instead of Settings adding the option, GNOME Tweaks can have the options for keylogging there, as Tweaks is typically used for features that aren't properly implemented.