Bug 473570

Summary: Allow sending arbitrary keypresses to any chosen application
Product: [Plasma] kwin Reporter: Antti Savolainen <antti.savo>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: wishlist CC: nate, xaver.hugl
Priority: NOR    
Version First Reported In: 5.27.7   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Antti Savolainen 2023-08-20 18:32:28 UTC
SUMMARY
Many programs will probably never support the builtin global shortcuts of Plasma. The bridge this gap with programs like OBS, I wish to have an option to send any keypress to an application. As far as I know, hyprland does have already implement this sort of functionality https://wiki.hyprland.org/Configuring/Binds/#global-keybinds
Comment 1 Nate Graham 2023-08-22 21:34:11 UTC
The problem is that this somewhat defeats the Wayland security model and disincentivizes apps to implement the standard protocols. It's a complex topic rife with desktop politics for sure.

What specific use case you you need this for? Start/stop recording in OBS?
Comment 2 Antti Savolainen 2023-08-23 10:34:19 UTC
Yep. Start/Stop OBS while in a fullscreen application for example. Make it so that kwin passes only the keys the user has explicitly specified to the specified program and none else.  

I'm thinking maybe make the functionality a bit more obscure to find. An "Advanced Options" button in the shortcuts menu which only appears if you install and additional package. This way developers will be less likely to start relying on it.
Comment 3 Zamundaaa 2023-08-23 11:06:58 UTC
Making the functionality hard to find just makes it harder for the user while not incentivizing application developers to do the right thing a lot. OBS just needs to implement the global shortcut portal.
Afaict there isn't even an issue for that at https://github.com/obsproject/obs-studio/issues, so that would be the first step towards making that happen
Comment 4 Antti Savolainen 2023-08-23 16:21:05 UTC
Alright, thank. I'll go complain to them.
Comment 5 Antti Savolainen 2023-09-29 14:06:55 UTC
I've been lazy, but I finally decided to look into this. OBS keeps their feature requests in a separate location and I found a request for global shortcuts portal here https://ideas.obsproject.com/posts/2066/implement-globalshortcuts-portal
Comment 6 Antti Savolainen 2023-10-26 00:06:01 UTC
For future reference, it seems that a less nuanced way of achieving this already exists in the KDE settings. In Applications -> Legacy X11 App Support you can allow legacy apps to read key inputs. This sadly doesn't allow you to set specific keys as allowed and mouse forward and backward do not get passed.