Skip to content

[Feature Request]: adopt xdg-desktop-portal GlobalShortcuts API #38288

Closed as not planned

Description

@jokeyrhyme

Preflight Checklist

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

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:

These are tracking issues/discussions for other desktop environments:

Activity

  1. Nantris commented on Jun 19, 2024

    @Nantris
    Contributor

    It seems like this would address #42573 and #15863.

    Wayland finally has practically all blockers resolved after many years, and as a result it is increasingly popular. This, or a comparable solution, really must be implemented for Electron to be living up to what it promises. Entire applications rely on the globalShortcut feature.

    Users are going to be forced onto Wayland in the coming months and there isn't even a meaningful discussion yet on this topic. That discussion really needs to begin ASAP.

  2. Nantris commented on Jul 9, 2024

    @Nantris
    Contributor

    Friendly bump. The window to address this without massive disruptions is closing.

  3. codebytere commented on Jul 20, 2024

    @codebytere
    Member

    I understand this as a goal but we're not prepared to or interested in deviating from Chromium in order to accomplish it. Our entire globalShortcuts mechanism is directly plumbed to chrome/browser/extensions/global_shortcut_listener.h.

    Your best path forward here is to raise an issue with Chromium at https://issues.chromium.org/issues and ask them to update their underlying implementation.

  4. beedell-roke commented on Jul 20, 2024

    @beedell-roke
  5. benstigsen commented on Jul 22, 2024

    @benstigsen

    #38288 (comment)

    If anyone creates a Chromium issue, link it here. Otherwise, if nobody has, I'll do so.

    As far as I can tell, there is already an open issue about this (https://issues.chromium.org/issues/40759171)

    Quote (latest message Apr 13, 2023):

    My understanding is this is still blocked on crbug.com/1196508, because whether the interface is actually needed or not is not clear.
    Note that, if we need this for wayland, at least we need extension API (i.e. we cannot implement on top of the current protocol fully, AFAIK).
    If needed, we can add that to exo (on CrOS), but adding it to Linux (e.g. weston) is another bar.

  6. lifebound commented on Nov 21, 2024

    @lifebound
  7. Nantris commented on Nov 21, 2024

    @Nantris
    Contributor

    @codebytere can we get this re-opened in light of the news above? Or otherwise should we create a new issue? Lack of global shortcuts is killing us.

  8. benstigsen commented on Nov 21, 2024

    @benstigsen

    @codebytere can we get this re-opened in light of the news above? Or otherwise should we create a new issue? Lack of global shortcuts is killing us.

    Electron is based on Chromium. So xdg-desktop-portal will be included when they make use of the Chromium version that patch was made for. Re-opening does not make sense, as it has now been solved. Now we just have to wait.

  9. Nantris commented on Nov 21, 2024

    @Nantris
    Contributor

    @benstigsen you're right. I'm conflating this with issue #42573.

  10. Malix-Labs commented on Apr 16, 2026

    @Malix-Labs

    #38288 (comment) from @benstigsen :

    it has now been solved. Now we just have to wait.

    #45607 seems to suggest otherwise (or is it unrelated?), in which case this issue should be reopened

    Else, it can stay closed as not planned

  11. benstigsen commented on Apr 16, 2026

    @benstigsen

    #38288 (comment) from @benstigsen :

    it has now been solved. Now we just have to wait.

    #45607 seems to suggest otherwise (or is it unrelated?), in which case this issue should be reopened

    Else, it can stay closed as not planned

    As far as I can tell, that issue is related to a bug of the feature, whereas this issue is about the feature itself. If the bug still exists, the issue you link should be re-opened. Not this one.

  12. jokeyrhyme commented on Apr 16, 2026

    @jokeyrhyme
    Author

    what's the oldest version of electron that has this feature? or is it yet to be released? cheers! <3

  13. Nantris commented on Apr 16, 2026

    @Nantris
    Contributor

    It's not clear that global shortcuts work even in the versions that have this change (and I'm not sure which do sorry.) I just wanted to let you know that personally global shortcuts remain dead for us on Wayland (which is a big problem since perhaps our biggest feature is the global shortcut.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions