Repository navigation
Conversation
|
OBS Studio can only rely on Portals (cross-DE and display protocol agnostic) or up-streamed non-ext Wayland protocols. |
|
Can I know why? What is the problem with this solution? |
|
Unlike Portals that are DE-agnostic (and display protocol agnostic), your protocol will never spread beyond a few WM there is no point to support this kind of protocol from an application standpoint. An application should mainly rely on DE-agnostic API and if really needed on Wayland protocols from wayland-protocols repo. Out-of-focus hotkeys falls upon the portal umbrella since this is outside wayland-protocols scope for desktop applications, both OBS Studio and the Global Shortcut portal needs changes. Edit: And trying to get around it (portals) is not the proper way long-term wise. |
I don't really understand who decided that. The compositor already owns the input so I don't really get why we need portals for this matter. The goal here was to try to change that, as there is, imo, no need for it to be this complicated. Also the portal is probably dead on arrival for OBS because it doesn't let clients rebind their keys freely. Also, my goal is to push this in as many compositors as possible eventually, and the more support there is for it the stronger the case for an official proposal will be. Now I get that you may not want OBS to carry the implementation of an experimental protocol, but as I see it it would harm no one and make global shortcuts work out of the box for a significant portion of users already. |
|
I'm opting to reopen this for further comment and discussion, as from where I sit, there hasn't been any meaningful movement on the portals piece for several years at this point, and a less-than-ideal solution is better than just sitting on our hands waiting for something theoretically better to arrive. |
|
I'm not categorically against this, but I do have some concerns with the general approach here. Reading between the lines in your comments on the Hyprland and Niri PRs, trying to get this merged sounds like a tactic to eventually leverage the inclusion here for an upstream proposal to wayland-protocols, and that just seems backwards to me.
(Ignoring here that filing this PR goes against that plan too, because it's not in Niri yet, and it was filed before it got upstreamed to wayland-protocols) And I'm sorry to break it to you, even though Hyprland is flavor of the month, the market share of it and Niri combined is tiny. Even moreso for users that also use OBS to the extent they require GHK support. As someone who's hanging around So even if this gets merged, I doubt that is going to give you any kind of traction for a wayland-protocols proposal. What you should be focusing on is trying to get this into Plasma and/or GNOME, or even COSMIC, because that is where the majority of users is (especially ones coming directly from Windows that already have extensive setups and require GHK support). But I suspect you know as well as I that that is unlikely to happen unless there is an official protocol (you might have luck with Plasma, but I don't see it happening for GNOME). To be clear, my concern is not with the way this functionally works, but with the why this should be merged and the general approach of standardising the protocol. Let's be ultra optimistic and say that by some miracle both Plasma and GNOME merge your protocol as We are the ones that will ultimately get the support requests. We tell users this was never a standardised protocol. Now either they question why we merged a non-standard implementation in the first place, or they run to their DE's bugtracker and file a complaint that'll either get closed or receive a bunch of pointless comments before being closed. We have seen harassment campaigns in the wayland-protocol space before, and I'm not sure that OBS wants to be a source of it. I do think the approach of how the hotkey assignment is handled makes sense, and in fact it's something that I proposed myself in the OBS dev channel a while ago during a discussion about the obs-wayland-hotkeys plugin and the shortcomings of the current portal design:
From my understanding your protocol essentially adds a feedback mechanism to let the application know that the assignment was denied, plus a reason why. And also of course a way for bilateral revocation of assignments. Which all of course makes sense. But implementation should come after standardisation (or rather during the standardisation process as |
Yes that is correct. I don't think it's that backwards though, as far as I can tell this is how a lot of the current
I agree, I'm going to file an official proposal very soon. At the time I made the initial Hyprland PR, I didn't really expect it to get merged so fast.
I disagree here, for the same reason as above. What got those wlr protocols upstreamed is that clients and compositors were already shipping them. OBS is probably the most cited application for this whole problem (#10538 has been open for years), and for what it's worth,
If it gets to xx then implementations during that phase are how the experimental namespace is supposed to work in the first place, and removal on rejection is a known cost of that model. I'm fine being held responsible for that here:
Worst case, a feature that currently doesn't work at all goes back to not working.
That is the plan eventually. For GNOME I agree it realistically only happens after upstream (they don't even implement most
Yes, the idea is that the client always knows what is happening with its bindings. The "you can suggest a shortcut but the DE may silently ignore it" thing from the portal means OBS can't even tell the user why their hotkey is dead. |
|
Fair enough. As I said, I'm by no means against this, I just found it a bit odd. Regardless, about this:
My main point wasn't about the code issue, reverting the PR commit is trivial. I'm mostly concerned about the support aspect, because it's our Discord and Forums that will get the brunt of it. At the end of the day it's not my call to make (I'm not part of the OBS team), I'm just raising the concern for consideration. |
|
I created the official proposal here: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/525 |
It isn't how it is supposed to work, but it is how it works in practice. It's a lot harder to argue against protocols that have broad adoption than ones that don't. |
xx_hotkey_v1 was merged upstream as an experimental protocol and supersedes vicinae_hotkey_v1.
|
The protocol got merged as I updated this PR accordingly. The revised version of the protocol adds explicit support for modifier keys and mouse button triggers. |
That thread was an... interesting read 🙃 |
|
For the record, we don't have any plans to implement that protocol in KWin. Rather than solving the problems the global shortcuts portal has and being universally better than it, it just makes a very different set of tradeoffs, and those tradeoffs conflict with our normal global shortcuts system. Just to be clear, this isn't about protocol vs. portal or whatever (since the wayland-protocols discussion went there quite a lot, when the transport mechanism of the communication is quite irrelevant here), the protocol just has a lot of problems compared to the portal, like
If there's interest in making global shortcuts work in OBS, we'd be happy to help improving the portal though. |
|
@Zamundaaa it would have been great to discuss this on the freedesktop thread directly, instead of voicing those concerns just now 😓
I don't really understand how the protocol is preventing that? You can implement granular permissions with this as well. You know the
That's a real trade off, polluting the shortcut namespace permanently is also annoying and will require manual cleanup from the user at some point. Reservations dying with the client have this benefit. For conflicts, as said above there is nothing preventing the compositor from assisting with that, and with this protocol the client is also aware of it and can show relevant UX to the user.
99% of the time that is what we want, most apps that are broken today would not suffer from this. I reworked the protocol in order to leave room for other kinds of bindings if necessary, so I don't see that as a hard blocker.
This one is true in the sense that currently there is no mechanism allowing the compositor to change the binding and let the client know about it. If that's really needed it could be implemented, though. |
Maybe I should've, but other people were already bringing forward similar concerns and I'm not actually interested in improving that protocol proposal as long as the underlying principles (that the app chooses a strictly specified trigger without user interaction, and that shortcuts are ephemeral) stay the same.
The only thing the system could do with that is throw up a contextless prompt for every single requested bind asking the user if it's okay. If that sort of UX would be acceptable, you could just do the same thing with the global shortcuts portal in better, because it can bundle the request for many shortcuts into a single prompt and it doesn't have any of the other limitations.
Having the app have a secret list of which shortcuts are reserved does the opposite of helping with that. The user can accidentally assign conflicting shortcuts just by not having apps run at the same time. When the conflicts happen, instead of the user being able to press "reassign" on a prompt like this: Or being able to delete all shortcuts of the app (or an action set, or whatever) with a simple button press, on app startup they'll get prompted by the app about conflicts, or shortcuts are silently assigned to nothing at all. Now scale that up to more than one app using the protocol.
Not really, because the shortcuts aren't permanent. To make that work even somewhat well, every app would need to be running all the time.
It might be what you want, but not what I or other Plasma developers want. Keeping the protocol open to adding more application-controlled triggers is also just not good or flexible enough. Think about all the non-keyboard triggers a user may want to use: macro keyboards, touchpad swipe, touchpad pinch, modifier key + touchpad gestures, extra mouse buttons, modifier key + mouse scroll, stroke gestures, touchscreen swipe, touchscreen edge swipe, touchscreen pinch, gamepad buttons, foot pedals, eye tracking, hand gestures (with the 3D IR camera in laptops), door sensors, any smart home integration really, you name it. Even just the more common ones of those is not something I'd ever expect any single app to handle, let alone every application in the ecosystem. |
In my eyes that is a good thing though? Why would an app that I am not currently using be blocking the assignment of a shortcut for another? If it's 2 applications that I never use together what gives the DE the right to force a different workflow on me? It is nice that the DE warns me, but at minimum the prompt in the screenshot should give me an "assign anyway, I don't care" button, not block double-assignments entirely. The idea that a shortcut can only be bound to one single action is wild to me anyway. That has long been a critique of the shortcut portal implementation as well. I don't know if the portal requires this or if DEs just decided that's a good idea, and honestly I don't much care either way, because it doesn't make sense. In the context of OBS (because turns out we are on the OBS repo where this discussion doesn't really belong) it's not unusual to bind the same shortcut to multiple actions. The
They don't though. If the application isn't running, there is no conflict, so it needs no resolution. When the app is opened and there are conflicts, that is the time to worry about conflicts. |
The protocol doesn't change anything about that, it just has a bug where in some specific situations two different applications can have conflicting shortcuts while they're not running at the same time. If you want to be able to assign the same key combination to two shortcuts at the same time, you need to request that from your DE's shortcuts implementation. I don't think there's anything in the way of implementing that in Plasma at least (and if there were such limitations, again, a new protocol wouldn't help). |
|
@Zamundaaa Thanks, that's helpful. As a user, here's what I'd want from the portal to make it work for OBS:
I've opened an issue for (2) and (3) on xdg-desktop-portal: flatpak/xdg-desktop-portal#2142 Would KDE be open to backing these as a portal extension? Feedback on either issue would be very welcome. |
That would limit shortcuts to keyboard combinations again. Apps can suggest default key combinations when first adding shortcuts, but changing them afterwards must go through the system UI.
That @jpetso and I already talked about, and I think it would be pretty useful. Action sets have precedent in other systems like Steam Input and seem to work quite well there, without reducing flexibility. |
This is bad. Most applications expect to be able to change their own bindings, using their own UI. Coupling that to a compositor specific UI just makes it very inconsistent and is a huge burden for app developers. There is no guarantee as to what the compositor UI will support or not. This restricts what the application can do in terms of UX. Also, standalone compositors do not provide any. But I already explained all of that in the freedesktop thread, I'm not going to repeat myself here.
In general, I think apps should be able to surface the fact that a given shortcut can't be bound by themselves, so that they can assist the user with the matter the way they want, instead of having to deal with a slightly different experience everywhere. I think the disagreement mostly comes down to the fact I'm an application developer trying to target every platform while providing a unified experience. The recurring problem on Wayland is that not enough freedom is given to clients, and as a result the answer to a given problem is slightly different everywhere, when there is an answer at all. I want my app to be able to help with things and provide the onboarding I want. What I'm aiming to do with this protocol is give more responsibility to the clients so that they can have more flexibility. |
|
I'm just a regular user, but I think that is also an important perspective to consider here. From @\Zamundaaa:
As a user, ...I don't want this. Are you sure that is what your users are actually looking for? Sure, if it's a KDE shortcut such as maximizing/minimizing windows I would want it there, but if I want to configure a keybind to start recording with OBS, my first thought on how to do it would be to open OBS and configure their keybinds within their application. I'm not going to open the KDE settings, go to shortcuts, and search for the option to start recording in OBS there. That is how Windows and MacOS do it, so why would Linux be any different? Why would the UIs of cross-platform applications have to handle Linux in any different way? If applications used the portal approach, then there would be a double-confirmation issue where the users sets the shortcut they want on the UI, but then the portal would prompt if they want to add the shortcut. Yes, I do want to add it, I literally just configured that shortcut. Either way, I agree there should be a way to at least see all the currently registered shortcuts, but nothing about this proposal makes it seem like it would be completely impossible/unfeasable to later add the option for the compositor to modify those shortcuts directly |
This isn't an either/or situation. You can't assume that the application is well-behaving. OBS may provide ways to change global shortcuts but that doesn't mean that all applications that use global shortcuts will. Changing or unsetting them on the compositor side would be the consistent option you have.
The portal approach wouldn't ask you if you're sure you want to do that or not. Portals are not UAC prompts on Windows. Instead you would click something in the application to change the hotkey binding and the application will communicate with the portal to prompt the user with a dialog that lets them set the trigger. The whole binding process happens via the portal dialog. There's no need for the application to know what they picked or for the user to go into their DE's settings. The non-portal approach is that the user clicks something in the application then they press the keybinding. When that happens, the compositor sends that binding to the application only the application to (hopefully) send it right back to the compositor in the form of a request to create a hotkey, and the compositor (hopefully) binds it. The issue is that the application technically doesn't need the user input at all. Just because the user told it to bind to a particular keyboard combo, that doesn't mean that's the one it will send the compositor as part of the request. The application can also lie about the binding that's been set it's up to the application to determine how to handle failed bindings. |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as abuse.
This comment was marked as abuse.
This is exactly the "dual/split functionality" issue that I was alluding to. The fact of the matter is that the "standard" for applications has been that they are the ones in control for shortcuts. This is true in all other mainstream desktop operating systems, and for a good reason. Imagine videogame keybinds for example, where actions greatly vary depending on which "context" the game is running. It would be completely immersion ruining and non-standard if I was surprised with a generic GNOME or KDE portal prompt when I was trying to change the keybind for opening my inventory in Minecraft, especially since there are many mods and texture packs that are specifically designed to make the GUI screens feel more immersive.
This hasn't been "breaking" behavior in any other OS, so why would it be here? Popular apps with millions of downloads such as Discord, as well as smaller nicher ones, are able to handle this without any major issues.
That is not an "issue", that's a feature. There are many apps where you can download and install "presets" online from other users that already have a specific workflow of hotkeys/keybinds, you just copy paste and those settings get applied to your system as well. You don't explicitly input the exact keybinds you want, you just trust the application to extract them from the desired preset |
|
While I agree with your general argument, this section is disingenuous to say the least:
The portal and this protocol are not designed or even intended for in-application shortcuts. They are meant for Global Shortcuts that can be used to trigger actions in the application while the application is not focused. That being said: Again I don't think this PR is the place to discuss the merits of portal vs protocol vs whatever you can think of. |
This has nothing to do with videos games. Most don't even use global shortcuts. Even if a global shortcuts portal/protocol was generalized into something that supports normal shortcuts as well, nothing would require that the application uses them. Video games could still take keyboard input and remap them internally as they wish. Also the fact that buttons do different actions in video games depending on the context has very little to do with keybinds. Nothing dictates that an application must only use a keybind to do one thing and the apps internal context is irrelevant.
I never used the term "breaking" so I don't know what you're quoting. I also wasn't referring to any problem that would happen at an OS level. The problem I described would be app-specific and would apply to ones that are misbehaving do to bugs or something else. I'm describing a problem with the process.
It's not a feature. I know that a lot of people's first intuition is that apps should be able to do anything without push back but that's truly a terrible way to design software. The reality is that even Windows requires an application to register global hotkeys. They're not treated like normal input and the registration isn't always successful. The application isn't commanding the OS to do anything, it's a request. The reason why it feels like apps can just set whatever keybinds they want is because Windows usually complies and that would be the case for a portal as well.
I don't see why you think that would cease to be a possibility with a global shortcut portal. You're muddling a lot of things are actually separate issues. If you're not familiar with how these things work internally then you might get the wrong impression of how they work.
Fair enough. |
|
Going to make a formal request that comments here stay on-topic to this specific PR, which is providing a solution to a problem. The conversation is important in general to the overall topic of the global shortcuts portals, but, as mentioned this PR is kind of a poor place to voice those opinions as it's unlikely that those in charge will hear them here. Let's focus on this specific PR and the code, implementation details, and any missing or improperly handled edge cases. I'm leaving the conversation here as it has been, for the most part, cordial and feels worth preserving for posterity as part of the overall discussion in the ecosystem, but further off-topic discussion will be removed. |
|
Will this be updated to support the recently upstreamed |
|
I didn't see this when it was posted, but the problem with this is the same the portal already has: It requires an application-side implementation that no other platform requires. You would need a UI that combines various actions to be then assignable via a single shortcut. This is something that neither Windows nor Mac, nor X11 for that matter require. In all of them you can simply assign the same hotkey to all 3 actions and the rest is handled already.
To be fair, in this case the same UI could be used on every other platform too, but it is still reinventing the wheel for something that has existed for decades. However, in the case of OBS multiple profiles or scene collections also complicate this matter. Assignable shortcuts are only listed for the currently loaded profile and scene collection. This means you wouldn't be able to combine multiple actions that would affect different scene collections once they are loaded because at configure time the action simply does not exist. So for example say you have 2 Scene Collections: This is also one of the reasons why the portal is simply not sufficient for OBS' usecase, as was mentioned before and also in #13680. The portal also has other issues with handling profiles/scene collections (mentioned there too), but that's besides the point. Either way, making this work would require a considerable overhaul of how profiles and scene collections are loaded. With that in mind, @aurelleb how is the situation with this PR? From my understanding this would be supported because setting the shortcuts comes from the application side. But I'm unclear whether all actions would be triggered correctly. |
The claim was that it would be impossible for an application to map multiple actions to one binding. My point was that a protocol literally can't prevent that because once the application gets sent the event, it can map it to multiple actions internal if it wants. That was all.
I personally never like hearing that we must do something one because the Windows/Mac/X11 do it that way. Something can be around for a decades and be lackluster or straight up bad. The way global shortcuts are handled on other platforms, are not by any means comparable to the greatness that is the wheel.
I'm pretty sure everyone that wants to implement this functionality via a portal is open to the idea that the portal needs reworking and I don't think any are pushing the idea that apps should significantly change themselves to adapt to the current portal. In my case, I'm not suggesting that the existing portal is a perfect solution that is sufficient as-is. One of my issues with My personal opinion, whether it's a portal (my preference) or a Wayland protocol, is that global shortcuts should not be a completely separate means of input. An application should be able to register all application shortcuts with the compositor/DE but would be able to request that some of them can be triggered without focus. Then if the compositor denies that shortcut it's "globalness", it will automatically fallback to acting like normal shortcuts. The compositor would be aware of all known bindings in the running applications and it would be able to track, advertise, and manage collisions between all of them. I would also like if shortcuts to be bound to arbitrary input, not just combinations of keyboard keys. I can imagine a compositor using a mechanism like that to provide the user with something somewhere in it's UI that informs the user that there are global shortcuts active. It might even give them a dropdown that allows the user to temporarily disable some of them or remap them while still keeping the application in the background. Maybe it could allow some of them to be mapped to a button in the desktop's UI. The compositor could even potentially allow the user to override the shortcuts in the other direction and promote normal application shortcuts to global ones. Windows, MacOS, and X11 don't do things that way, but I don't think that's a problem. I don't think any part of what I'm proposing would be at odds with having profiles. The arbitrary input thing would need some figuring out but it could be done by having the compositor expose some token to the app that it can store and recall to rebind. |
This might have been misunderstood. I wasn't saying that it's not possible at all, what I was saying was in the context of binding the same hotkey to multiple actions on the compositor side. The OBS in-app example was just one usecase where it's actually relevant on this repo. But there are also cases where you'd want to bind the same key to multiple actions in different applications. For example my Microphone source is (well, was on X11) set to push-to-mute using the same key I used in Discord for push-to-talk. That way it was possible to talk to teammates without having my side of the conversation on stream. That is impossible to do with the current implementation on GNOME and KDE because they don't allow a shortcut to bind to multiple actions. But that gets into the portal argument again which this isn't the place for. The issue is moreso the work required to even make this work as laid out above.
I generally agree with that. And I didn't say that we "must because they do it that way". I'm saying that sometimes things are around for decades because they just make sense. From an application developer and even from a user perspective it just makes sense to handle things the same way (as close as can be) on all platforms. 3 of the 4 existing platforms already provide this, why do we need an entirely different flow for the last? This protocol provides the missing piece, at least on compositors that implement it. The fact users are going to be looking for hotkey configuration in the application in question and not buried somewhere in a system menu seems fairly straight forward to me. Whether or not the way Windows/Mac/X11 handle this on the OS level is implemented well or not isn't a concern of the application as long a) the binding "just works" and b) it gets its event. And that is the crux here: it isn't handled well in the portals because it doesn't cater to application needs, nor user needs.
Nothing is keeping us from eventually implementing the portal once it's actually usable for OBS' needs. Nothing is keeping us from shipping both in parallel either. But the reality is that the portal is not there, and likely won't be for a long time given that these concerns are not new and have not been addressed during its standardisation. On the other hand, the protocol is here already. And as a reminder, if someone wants to use the portal today there is a plugin to do so. There is nothing wrong with using a plugin for your needs, that's what they are intended for. But the plugin has limitations that are the result of the current portal design.
I feel like that was laid out fairly plainly. The compositor can deny a binding (or even later revoke an existing binding) and the application is being informed about it. What the application does with that information is up to them. As for this PR, the shortcut is getting unset and the reason is logged in the OBS log, so the user can try again. Ideally this would also be shown in the settings UI, but I don't think that was added or I missed it.
That is outside the scope of the portal and this protocol. They both handle global shortcuts only.
It is in the way it currently works. See the linked PR in my previous comment. If your proposal is to change the protocol, then you're in the wrong place. We can only work with what exists and not with a hypothetically better solution. |
That's completely fair.
I accidentally got rid of this while trying to reword and shorten my very wordy post but the idea that the application can provide a UI for setting/changing the shortcut isn't something I'm against. In fact I would also expect to set them via the application UI. However, I think that it's wonky that the way a user sets keybinds through this protocol involves the compositor sending a key combo to an application on behalf of the user just so that the application will hopefully send same key combo right back to the compositor as global hotkey bind request, again on behalf of the user. Of course by that point the compositor can't know if the app is asking on behalf of the user or acting on it's own. That confusion could have been avoided if the application could trigger some process that allows the compositor to handle the complete keybind process. That would probably be in the form of a dialog and I can understand not wanting that process. That's why I'm suggesting changing the question a little bit. If the question isn't whether or not the the shortcut + binding can exist at all but whether or not the shortcut can be access without focus, then maybe a solution can be worked towards that satisfies Aurelle's and your needs and the wants of the compositors. I feel like that would already
The protocol is here in the sense that it's been merged into the Wayland protocols as experimental but it hasn't been implemented KDE or Gnome and there doesn't appear to be interest either.
And I'm in sure in other software it would be made into a normal hotkey.
I understand that but the thread as been mostly about disagreements to either approach will little attempt by either side to really acknowledge the concerns of the other. I'm not sure where that discussion would really happen when even the question of whether it should be a Wayland protocol or portal is in dispute. |
Yes full control is given to the client so this kind of thing can be done, as long as the compositor doesn't impose a policy that would make e.g double binding impossible. |
@aurelleb could probably clarify but that's not how I understand the mechanism at all. The request goes from the application to the compositor, the compositor just decides whether or not it binds or denies and sends an appropriate response.
Of course it requires compositor support, that was never in question. But so does the portal if and when it gets a new version addressing the issues that makes it borderline unusable for OBS. How long that's going to take is anyone's guess seeing as there seems to be a fundamental disconnect with what application developers and users actually want. And again, nothing is stopping us from having both, it's not one vs. the other.
Maybe, maybe not. That's up to them and their philosophy, so not really relevant for OBS.
And the whole discussion was largely off-topic as well. This PR is about the implementation in OBS. If there are concerns about the protocol, or the portal for that matter, they should be raised there. The way I see it the protocol as it stands right now seems to fit into the keybind flow OBS already has. |
Correct. The protocol is just the application talking to the compositor.
I'm describing the process of how a user would assign a shortcut within an application's UI.
Yes, I'm bring up compositor support because clearly this PR is going nowhere because it's pushing an implementation of a feature that the more popular compositors don't want to implement.
Yes I agree, and yet some of those app developers seem to feel that they know how users want to use their software better than the user's do. On the discussion in the Wayland protocol git, there were users, toolkit developers, and compositor developers expressing the kinds of things they want to do be able to do with global shortcuts and shortcuts in general and many of them. They were largely ignored by a few app developers who felt their opinions mattered more.
Then the discussion should probably just be ended here.
Sure but it also leaves very little room to improve on it. |
That's what I thought, but I didn't want to assume it because this sounds disingenuous at best. You're describing every application ever because there's no other way to do it unless the application is insane enough to bind to the hardware event directly.
Counterpoint: At least it is an option on the more niche compositors as opposed to nothing at all.
The same can be said about anyone, including some of the Wayland folks. The difference here is that an application developer can have a vision for how they want their software to be used, and users who do not like that workflow can just not use the application. But the same can't be said about the interaction between application and desktop environment. The application doesn't get to chose what environment their users can or should use. But also I think you misread that sentence. I didn't mean to say a disconnect between application developers vs. users, but rather between application developers and users vs. how the protocol works. |
The way I read it is that @myownfriend was questioning whether it's the application that really needs to know the key combination first. As an alternative, I imagine a different flow:
This is pretty close to how the global shortcuts portal currently works, with the key difference that:
I'm imagining this as an addition to the existing portal API in the GlobalShortcuts object. Obviously this is not something that exists today. But perhaps something that would be acceptable to compositor developers, preserving the compositor's flexibility? While also allowing the app-side workflow of "Show current keyboard shortcut(s) -> Press button to modify -> Press keys to assign -> Done". Footnotes
|
|
The flow you're describing makes sense at first glance, but it immediately hits a wall once profiles and scene collections come into play where you have different sets of keybinds for different actions. Possibly also the same keybind for different actions, or different keybinds for the same action. What you'd need to do in that case is ask the user to rebind every single key unless you want to keep dead actions bound in the compositor that will never get cleaned up. This is precisely one of the issues why the portal is not serviceable for OBS. You're looking at it from the point of view of setting the keybind for the first time, but that is not the problem OBS faces with the portal (see also the comment in #13680). The main issue is not with showing the shortcuts, but with setting them in the first place - and doing so from a saved state, not for the first time, i.e. without user interaction. And this is what this protocol allows: requesting a global shortcut from the application side.
As noted before, suggestions for improvements on the portal side or entirely new API proposals should be voiced there. There is nothing OBS can do about these suggestions. |
You're correct! That's exactly what I was doing. I'm aware that applications have been assigning shortcuts that way for a long time but when you really lay out the order of operations, it doesn't make sense.
If I'm understanding this correct, I've actually thought about something like that before. It's kind of like how some emulators set up controllers but with a system-provide prompt that's handling the whole process, right? That definitely solves the communication and trust issues for user-assigned bindings but I couldn't think of a way that would be compatible with apps being able to set default bindings or allow loading profiles of bindings like OBS wants to do. It also can become a security problem because the app is still in charge of requesting the prompt and if it doesn't it when the user isn't expecting it and they're typing then the user may accidentally input a binding. That's why I figured it would make sense not to single out global shortcuts and instead look at the problem from the perspective of shortcuts in general and try to figure out where the concerns really lie. Right now when it comes to normal in-focus application shortcuts, there's no security concerns. Applications can set whatever key combinations they want because the compositor is already insuring the app only gets input that's meant to go to it and the application can do what it wants with that input. So the app having knowledge of the keybind isn't the concern and neither is the apps ability to use it. It only becomes a security concern when the app asks that it get some kind of regardless of whether or not its focus. If any app could do that whenever it wanted then it can be used maliciously. It's also just a usability problem because even a non-malicious app could have chosen a shortcut that conflicts with shortcut in another open application and theirs no guarantee the application provides a way for the user to change or unset the binding. So it's clear that the app shouldn't have final say on the creation and assignment of the shortcut and that the user should have ways to intervene. Lastly, I personally don't like the fail state for global shortcut creation on the app side. That's why I'm suggesting that the app would be able to create a kind of shortcut session/handler object with compositor. This handler object would allow the application to create, set, remove, and change shortcuts at any time while the application is running. It would be able to request that some can be triggered globally but it's not guaranteed that. If the compositor denies the application's request to make a trigger global, it will still act as a shortcut when the application is in-focus. Since this approach allows the shortcut object to exist and be usable without necessarily being global, it allows for a lot of possibilities.
and of course it would also give the compositor additional context that it could use to decide if a hotkeys globalness should be accepted or denied. |
You could express whether they would meet OBSs criteria, whether they don't, or if they would work with some changes. Then there would at least be a proposal that people could work towards instead of endless debating which of the two existing solutions are less bad.
I don't think the applications devs and users are aligned here. Maybe some are, sure. I also haven't seen users wanting to handle global shortcuts only via a system settings but I don't think any are opposed to that as an option. This protocol is adamant that that can't happen and only the apps can control them. I've seen users say that they want a way to use non-keyboard input (touch/mouse gestures, controllers, and other input devices) and I don't think any user is of the opinion that they shouldn't be able to change a keybinding at all. Both of those things are best handled if the user isn't completely reliant on the application to allow them to do those things. |
What OBS wants/needs has been discussed at length in this (fairly offtopic) discussion already. The protocol meets them, the portal does not. And this is also why I noted before that this is not the place to discuss the merits of portal vs. protocol, but for the actual protocol implementation.
That's the issue with the portal though? It isn't an option, it is mandatory, ripping users out of the existing UI flow. And this is both annoying for application developers (i.e. OBS) that built that UI and users that are now presented with a completely different UI that varies by DE, or may not exist at all.
This is not true on 2 levels:
Neither of which I would call "adamant that that can't happen". But either way that again is an improvement request on the protocol side. OBS has nothing to do with that until this was actually added to the protocol and OBS would need to handle it accordingly. But IMHO this is not a hard requirement for OBS right now seeing as it isn't on the 3 other platforms either.
Mouse button support was already added. While the other types are not currently supported, the protocol leaves room to add them:
This is just not in the first iteration that was already merged, because keyboard (and mouse button) events is what the vast majority of users actually use.
In no way did I suggest that either. |
I feel like the way I communicate things isn't particularly compatible with how you understand things. I'm not talking about the portal vs protocol. Both are flawed. I'm trying to propose a solution that would hopefully meet or exceed the needs of those who prefer the portal and those who prefer the protocol. That's why I spent an extensive amount of time describing that solution.
I'm not saying that the portal is superior to the protocol or vice versa. The portal is built so that applications can't provide their own UI for setting for global shortcuts, the protocol is built so that only the applications UI can be used to setup shortcuts. What I proposed would allow both. Also I want point out to anyone that may be reading this that the portal does not require that the user go into their system settings to set a global shortcut even though you may get that impression from this conversation. The global shortcut portal allows the application to prompt the user with a dialog that lists all of the apps global shortcut action and allows the user to remove them or change their bindings. It will usually come up by pressing a button in the application's UI.
At least in the situations where it is available, the user will be able to change or disable them. If an application uses the protocol and doesn't provide a UI for the user to change the binding then the user is screwed.
I was only talking about changing the bindings outside of the application, though I understand that my wording suggested that revocation would have been impossible, too. I was taking their wording from the protocol thread "This protocol lets a client choose and freely reconfigure its own global hotkeys: it requests a specific key combination and the compositor accepts it or denies it with a reason. The compositor stays the arbiter (it can deny, revoke at any time, apply any policy it wants), but within that the application manages its own bindings at runtime, with no out-of-band user configuration and no persisted compositor state." You're right that they said they were open to adding that if it were to become a requirement, but that issue was already brought up to them before the protocol was merged and they didn't ultimately make any changes to the protocol to enable that.
And what about controllers and other input devices? One of their complaints about the portal is that it tells the application what the binding is but in as a string and not in a machine readable way. If that's a requirement then an application would have to explicitly support a device in order for a user to bind a shortcut to it which is kind of absurd considering the actual input is ultimately abstracted away after the binding.
One of the users in the topic wanted to be able to bind shortcuts to specific devices so that they could have a second keyboard that they only use for shortcuts (using single button bindings and bindings with modifiers). That's not the first time I've heard someone express the desire to do that. Wayland currently doesn't even support a way to access individual keyboards so a new protocol would have to be made just to support that and the Wayland global keyboard shortcut would have to be compatible with that. With the "lets not think about it now" mentality, how can someone be sure that the protocol would be able to support something like that? One of the reasons that I think the protocol isn't a good skeleton or mindset to build off of is because of the lack of consideration for user-configured bindings. From the perspective of setting app defaults, it makes sense that a mechanism that allows an app to declare global shortcuts would be limited to things like keyboards, mice, and touch because there's no reason for most apps to assume a user has specialized/exotic setups. But user-configured bindings are a very different story. Since the protocol is build around the idea that users will configure shortcuts through the application, it does not distinguish between the two scenarios. In both cases, the application is just trying to create/change a binding. As a result, this protocol needs to explicitly support more exotic input setups . But if the process for the user-configured binding was offloaded to the compositor, then it wouldn't be limited to the types of input and the device groupings that Wayland or any protocol defines.
That wasn't a stand alone statement, it as connected to the sentence after it. I was referencing that the one thing the portal insures that the protocol can't is that the user will be able to change a shortcut. The protocol as it is is designed around the idea that the keybind can only be changed by the user if the application provides a way for the user to do that. So if the application doesn't do that that then user can't change the binding. I was mentioning that to make point that the portal, despite it's flaws, does insure something that users want. |
@Zamundaaa previously said that switchable shortcut groups are a desirable feature for portals, so I left that out of my (already long-ish) post under the assumption that these will be available too. I imagine it won't take much more than an extra shortcut-group string identifier to specify in the API for this "assign shortcut" request. |
|
@tytan652 @Fenrirthviti I just wanted to ask whether the protocol implementation is going to be merged. Even if it only works on a few compositors like Hyprland and Niri, having this functionality would be a big improvement for users like me. It doesn't prevent other compositors from adopting it in the future, and it doesn't get in the way if a better portal solution arrives later. Thanks! |
|
This PR, currently, has a lot of discussion and disagreement on it, and no approvals. The code itself has not been reviewed for correctness, which would be the next step if this specific implementation is going to be merged. Until review happens, we cannot say either way if it will be merged or not. We welcome reviews of the code, and we are keenly aware this is a solution where none currently exists, even if it's not perfect and may be temporary. It's on our radar, but unfortunately isn't a high priority compared to other items the main contributors are focused on right now. |

Description
Edit: updated to support the upstreamed version of the proposed protocol,
xx-hotkey-v1Implements the vicinae hotkey wayland protocol which allows clients such as OBS to bind global shortcuts.
A quick word about the implementation: this protocol is not a raw keyboard hook, and therefore didn't fit the existing shortcut model inside OBS. I'm not fully sure why OBS does this instead of using native APIs to register global shortcuts on other platforms, but I think my adapter is not too bad.
The protocol can return an error when a bind is refused by the compositor, in which case the global trigger will not be honored. Since there was no UI to communicate this kind of thing, I just let it be an error message in the console
Motivation and Context
Currently, there is no good way to bind global shortcuts on wayland environments.
The desktop portal solution is inadequate for most applications as it doesn't allow the client to control its global bindings to the fullest. Due to these limitations it is also not widely implemented.
Some time ago I came up with the
vicinae-hotkeyprotocol which simply mirrors the way global shortcuts work on other desktop platforms such as Windows and macOS. The client is free to bind, rebind, and revoke any global shortcut. The compositor only responsibility is to allow or deny the bind.This protocol got merged into Hyprland and there is an open PR for the niri compositor as well, two prominent wayland desktops.
The goal is to further the adoption of this protocol by getting more clients to use it. OBS is the main piece of software affected by the lack of proper global shortcuts on most wayland desktops so this would greatly help.
Technically, this would fix #10538
How Has This Been Tested?
Tested on my Gentoo Linux 2.18 machine, with my niri fork as the running Wayland compositor. This can also be tested with Hyprland git but niri is easier to build.
Binding a shortcut in OBS works as it usually does, but also activates when the OBS window is not focused.
Types of changes
Checklist: