Repository navigation
docs: document Linux portal identity / Wayland shortcut flow - #52222
Conversation
…tcut flow desktopName sets CHROME_DESKTOP, which becomes the Wayland app_id / WM_CLASS, the systemd scope name, and the app ID xdg-desktop-portal reports to portal backends. Portals now enforce that identity (GNOME 50 denies GlobalShortcuts binds for invalid IDs), so document the reverse-DNS requirement and the Wayland portal flow for globalShortcut: consent dialog on GNOME, silent binds on KDE, persistence across relaunches, the feature flag currently needed on GNOME, and the optimistic register() return value.
0c3f2c6 to
3ebd057
Compare
mitchchn
left a comment
There was a problem hiding this comment.
Looks good, just had some thoughts on trimming out details that devs might not need to focus on.
|
|
||
| The name (without the `.desktop` suffix) is the app's identity for Linux desktop integration. | ||
| It should be a valid reverse-DNS [GApplication ID](https://docs.gtk.org/gio/type_func.Application.id_is_valid.html) | ||
| such as `com.example.MyApp`. Electron exports it as the `CHROME_DESKTOP` environment variable, which becomes: |
There was a problem hiding this comment.
The CHROME_DESKTOP var is an internal implementation detail that Chromium provides to downstream consumers/packagers so we might not want to highlight it to app devs (i.e., they shouldn't be trying to read or modify it directly).
| If this value is not set and `desktopName` is not present in `package.json`, Electron falls back to a lowercased, | ||
| hyphenated slug of the app's name (e.g. `My App` → `my-app.desktop`), which is unlikely to be a valid portal | ||
| identity — packaged apps should always set it explicitly. |
There was a problem hiding this comment.
Should we adjust the default implementation to be portal friendly ?
There was a problem hiding this comment.
Changing the default value to a FQDN would be a break icon matching for most existing Electron apps. I think it would be safer to make this change in a future version once Forge and Fiddle respect desktopName and devs have had time to update and read the updated guidance.
There was a problem hiding this comment.
Agree, then it would be good to have a tracking issue to flip the default implementation.
|
Heads up: Windows CI builds moved to new runners on Monday and the old ones have now been removed. This branch predates that, so its Windows build jobs still point at the old runners and will sit queued forever if CI runs again. Rebasing on |
- drop CHROME_DESKTOP and systemd scope implementation details - point reverse-DNS naming guidance at the Desktop Entry spec - remove the xdg-desktop-portal dashed-name parsing bug callout - update the GNOME feature flag guidance: portal path is now enabled by default (#52221) - hold off documenting the optimistic register() behavior until the async registration API lands No-Verification-Needed: docs-only change
|
No Release Notes |
|
I have automatically backported this PR to "44-x-y", please check out #52889 |
|
I have automatically backported this PR to "43-x-y", please check out #52890 |
Description of Change
desktopNamesetsCHROME_DESKTOP, which on Linux becomes the Waylandapp_id/ X11WM_CLASS, the transient systemd scope identity, and the app id.Portals increasingly enforce this identity: GNOME 50.0/50.1 (Ubuntu 26.04) rejects GlobalShortcuts binds for app ids that fail
g_application_id_is_valid(), and xdg-desktop-portal ≥ 1.21 refuses sessions for ids it cannot resolve. None of this was documented, and the failure mode is a silent no-op.docs/api/app.md(app.setDesktopName()): recommend a reverse-DNS GApplication id +.desktop(e.g.com.example.MyApp.desktop) matching the installed.desktopfile's basenamedocs/api/global-shortcut.md: new Linux section describing the Wayland portal flow, GNOME's one-time consent dialog (pre-filled from the app's accelerators), KDE's silent auto-bind, persistence across relaunches keyed by app id, the feature flags currently required on GNOME (fix: enable GlobalShortcutsPortalPreferredTrigger by default on Linux #52221 tracks defaulting them), thedesktopNamerequirement, and theregister()-returns-optimistically caveat.Docs-only change; verified the described behavior on an Ubuntu 26.04 VM (gnome-shell 50.1, xdg-desktop-portal 1.21.1).
Checklist
Release Notes
Notes: none