-
Notifications
You must be signed in to change notification settings - Fork 17k
Closed as not planned
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
- modern Linux environments such as wayland and flatpak prevent applications from direct access to user input events (for security purposes)
- traditional approaches for implementing global keyboard shortcuts don't work here
Proposed Solution
- there's a new GlobalShortcuts portal API: https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.GlobalShortcuts
- when an electron consumer calls
globalShortcutfunctions ( https://www.electronjs.org/docs/latest/api/global-shortcut ) they should transparently attempt to interact with xdg-desktop-portal via DBus (when available) - this way, app developers do not need to make any other changes to their code (besides updating the version of electron they use)
Alternatives Considered
- it might be worth making this a new JS API instead, but I predict that would lead to poor adoption and thus increased frustration for Linux users of electron-based apps
- other approaches include using root permissions to bypass the wayland / flatpak security model in order to maintain direct access to user input events, but this seems a lot less safe than the proposed solution
Additional Information
These Linux desktop environments have already implemented the GlobalShortcuts portal:
- Hyprland: https://github.com/hyprwm/xdg-desktop-portal-hyprland/blob/2bdadd2d37f42b516587c64c963ea638c6df8355/hyprland.portal#L3
- KDE: https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/faf620bae9a6601e5380de96ceebce63bc7a062d/data/kde.portal#L3
These are tracking issues/discussions for other desktop environments:
- COSMIC: feature request: GlobalShortcuts portal pop-os/xdg-desktop-portal-cosmic#4
- GNOME: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/47
- wlroots (for sway/river and others): Global shortcut portal support emersion/xdg-desktop-portal-wlr#240
Reactions are currently unavailable