Gnome merges Global Shortcuts (gitlab.gnome.org)
from that_leaflet@lemmy.world to linux@lemmy.ml on 23 Feb 2025 12:21
https://lemmy.world/post/25954266

#linux

threaded - newest

infeeeee@lemm.ee on 23 Feb 2025 12:55 next collapse

It wasn’t clear for me what the hell is a “Global Shortcut” I heard the term first time in my life, I found the answer in the upstream PR:

It’s designed so that applications can register actions that can be triggered globally (i.e. regarless of the system’s state, like focus).

It’s strange it wasn’t possible until now, or the main thing it’s now DE independent?

On Gnome I use Run or raise extension, and with this I can run or switch to running apps with global shortcuts, so this was definitely working from Gnome extensions.

that_leaflet@lemmy.world on 23 Feb 2025 13:02 next collapse

Gnome Extensions run in the Gnome shell, so they have special privileges.

Wayland’s security focus prevents apps from listening in on all user key presses, which means they can’t know you used a keyboard shortcut unless the app is focused.

The Global Shortcut Portal was made to address this. An app registers for a global shortcut, and when the user activates the shortcut, the portal tells the app that it’s been activated.

infeeeee@lemm.ee on 23 Feb 2025 13:20 collapse

Thanks for the context!

[deleted] on 23 Feb 2025 15:42 next collapse

.

merthyr1831@lemmy.ml on 23 Feb 2025 16:38 collapse

It’s because this feature was implemented as a pseudo-keylogger on X11. All X clients could listen to the compositor state at all times (including input), even if input was focussed on another (potentially sensitive) application.

In Wayland, clients have almost zero knowledge of the compositor’s state. This was an explicit design choice to enhance security and enable modular features via wayland protocols. Of course, this also killed every implementation of app-specific global shortcuts.

Wayland protocols take a lot of time to get agreed on - They need multiple implementations across different compositors (usually means KDE and GNOME need to implement the protocol spec and agree to it) and the specs can take a long time to design and reach production.

Obviously this does hurt uptake for Wayland since issues can take years to resolve, but the core team are very aware of the pitfalls of X11’s development and have long preferred this slow and methodical approach in the hopes it’s sustainable and maintainable into the future.

umbrella@lemmy.ml on 23 Feb 2025 15:57 next collapse

i could have sworn it was already working for me on gnome, im surprised by this

but then again i havent used discord in a huge while now

that_leaflet@lemmy.world on 23 Feb 2025 16:33 collapse

The traditional insecure global shortcuts system works in Xorg.

umbrella@lemmy.ml on 23 Feb 2025 17:59 collapse

i’m using wayland though, i’m probably too tired to be making too much sense anyway.

arcidalex@lemmy.world on 23 Feb 2025 18:52 collapse

Xorg global shortcuts will work for anything using Xwayland, but not in anything thats wayland native

For example, in a game (using wine, which uses Xorg by default currently) your global shortcut will work. But in a wayland native window like Firefox, it will not if its the active window

umbrella@lemmy.ml on 23 Feb 2025 19:02 next collapse

oh i get it now. thats why i tought we already had it, im not usually aware of what is running under xwayland and what is not.

that_leaflet@lemmy.world on 23 Feb 2025 23:43 collapse

Are you sure about that? KDE has a feature that lets Xwayland apps snoop if certain keys are pressed, but Gnome does not.

arcidalex@lemmy.world on 24 Feb 2025 00:11 collapse

Yeah. The behavior i stated was how it works in Gnome. In KDE since Xorg passthrough is a formal thing, the behavior is different based on those options

mactan@lemmy.ml on 23 Feb 2025 16:20 next collapse

it’s still up to individual apps to implement the portal I think

merthyr1831@lemmy.ml on 23 Feb 2025 16:24 collapse

True, but the apps that cause the most complaints about features that Wayland lacks (Discord for this one) are usually among the fastest to enable the portals once they’re available.

Giooschi@lemmy.world on 23 Feb 2025 16:38 collapse

Not sure if Discord is the best example here, as it didn’t support the screen capture portal for a very long time.

priapus@sh.itjust.works on 23 Feb 2025 17:02 collapse

Discord didn’t take very long to add it at all, what took a long time was fixing audio streaming.

Zamundaaa@discuss.tchncs.de on 24 Feb 2025 02:16 collapse

Umm yes, they did take ages to support it. It took like 7 years…

priapus@sh.itjust.works on 24 Feb 2025 05:35 collapse

tbf, Wayland was hardly relevant for some of that. the first feature request I found was 4 years go. implementing it also required upgrading electron a few versions, so a decent bit of work.

communist@lemmy.frozeninferno.xyz on 23 Feb 2025 19:34 collapse

Does anyone know what the status on KDE implementing this is?

that_leaflet@lemmy.world on 23 Feb 2025 19:53 next collapse

Already merged there some time ago.

communist@lemmy.frozeninferno.xyz on 23 Feb 2025 20:12 collapse

I can’t find any documentation on how to set it up, do you happen to know where that would be?

I can’t figure out how to setup discord push to talk on kde wayland, specifically

that_leaflet@lemmy.world on 23 Feb 2025 20:40 collapse

Apps need to add support for the new portal system. Chromium is adding (or added?) support, so Discord may implement it once they use an Electron version with support.

If you’re using KDE, you can tell Discord to use X11 and use KDE’s feature to let X11 apps snoop on key presses.

communist@lemmy.frozeninferno.xyz on 24 Feb 2025 03:45 collapse

I don’t understand why they wouldn’t allow you to manually override things, i hope this gets added later, i’d like to be able to forward shortcuts to apps for push to talk even if the app doesn’t support the native portal

Vincent@feddit.nl on 24 Feb 2025 08:39 collapse

Because if it is freely overridable (which it used to be, on X11), other apps can override it as well - including malicious apps. The portal adds an explicit path that ensures that the user is in control, but does need to see wider adoption first. Which will surely be helped by GNOME support.

communist@lemmy.frozeninferno.xyz on 24 Feb 2025 19:56 collapse

I didn’t say it should be freely overridden, I said I should be able to manually override it

Vincent@feddit.nl on 24 Feb 2025 20:22 collapse

Yes, but that amounts to the same thing. The restrictions that prevent you from manually overriding it are there to prevent any app from freely overriding it. There’s a way to only explicitly allow you to manually override it, and that’s the way that’s currently being built and requires ecosystem support.

Zamundaaa@discuss.tchncs.de on 24 Feb 2025 02:13 collapse

It was implemented over two years ago.

communist@lemmy.frozeninferno.xyz on 24 Feb 2025 03:44 collapse

I can’t find a way to manually add entries in the settings, is there no way to do that?

How would I manually enable push to talk in discord, for example?

Zamundaaa@discuss.tchncs.de on 24 Feb 2025 13:23 collapse

You can’t. Apps need to support shortcuts in order to receive them…

For Discord, the X11 compatibility page has working options though.