#52221: fix: enable GlobalShortcutsPortalPreferredTrigger by default on Linux
Description of Change
Enables GlobalShortcutsPortalPreferredTrigger by default on Linux, so that globalShortcut works on GNOME Wayland out of the box. Inspired by a conversation with @mitchchn.
Chromium gates the GlobalShortcuts portal on GNOME behind GlobalAcceleratorListener::GetInstance added in crrev.com/c/7620219). When the feature is off, every globalShortcut.register() call fails silently, from the app's perspective. On GNOME Wayland (the only GNOME session type on Ubuntu 26.04), that means globalShortcut is a no-op unless every Electron app author independently discovers a Chromium feature flag.
This is a no-op outside GNOME. Verified against a local build on Linux (headless Ozone, private session bus, simulated XDG_CURRENT_DESKTOP=GNOME):
- Before:
globalShortcut.register()→falseon GNOME with no flags (listener never created). - After:
register()→trueon GNOME with no flags; portal session is created. - After +
--disable-features=GlobalShortcutsPortalPreferredTrigger:register()→false(user override wins). - Non-GNOME:
truebefore and after (unchanged).
Checklist
- PR description included and stakeholders cc'd
-
npm testpasses locally - PR title follows semantic commit guidelines
Release Notes
Notes: Fixed globalShortcut not working on GNOME Wayland by enabling Chromium's GlobalShortcutsPortalPreferredTrigger feature by default on Linux.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron