Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for inhibiting system shortcuts #2776

Open
ids1024 opened this issue Apr 24, 2023 · 6 comments
Open

Add support for inhibiting system shortcuts #2776

ids1024 opened this issue Apr 24, 2023 · 6 comments

Comments

@ids1024
Copy link
Member

ids1024 commented Apr 24, 2023

A mechanism to inhibit system shortcuts is generally necessary for things like virtual machines, remote desktop, and system shortcut configuration dialogs. This would also be useful for the Winit backend of Smithay, similarly to a VM or remote desktop client.

In GTK4 this is supported with gdk_toplevel_inhibit_system_shortcuts, which seems to be supported on Wayland, X11, and Windows. On Wayland this works through the Keyboard shortcuts inhibit protocol.

ids1024 added a commit to ids1024/winit that referenced this issue May 4, 2023
Implementation for rust-windowing#2776,
on Wayland currently only.

Wayland implementation should be done more cleanly, needs X11 and any
other applicable platforms, documentation etc.
ids1024 added a commit to ids1024/winit that referenced this issue May 4, 2023
Implementation for rust-windowing#2776,
on Wayland currently only.

Wayland implementation should be done more cleanly, needs X11 and any
other applicable platforms, documentation etc.
@kchibisov kchibisov added S - api Design and usability C - needs discussion Direction must be ironed out labels May 26, 2023
@kchibisov
Copy link
Member

kchibisov commented May 30, 2023

The API itself looks fine, so I don't have any issues implementing it. I'd assume it's per top level for each platform, right?

As for macOS I know that it's on you whether you do shortcuts or not, I'm not so sure whether you really have global shortcuts on it.

@ids1024
Copy link
Member Author

ids1024 commented May 30, 2023

On Wayland this is per toplevel. And the GDK function works that way too, so on X11 and Win32 it should either work that way, or GDK is able to emulate the same behavior using more generic APIs (I'm not entirely sure how keyboard grabs on X11 work.)

@madsmtm
Copy link
Member

madsmtm commented Jun 1, 2023

You can somewhat enable global shortcuts by having items in your menu bar that respond to certain shortcuts.

And actually, we have that in the default menu bar (CMD+Q).

@kchibisov
Copy link
Member

But you can clearly not bind them when you inhibit shortcuts.

@daxpedda
Copy link
Member

This can be done for Wasm as well, though only in Chromium, with the Keyboard Lock API.

@JoshLambda
Copy link

For reference, the crate global-hotkey does that for some targets (Windows, MacOs, Linux/x11) and could be used as a workaround for people who need it, until this issue is solved.

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

No branches or pull requests

5 participants