Skip to content

docs: document Linux portal identity / Wayland shortcut flow - #52222

Merged
VerteDinde merged 3 commits into
mainfrom
docs-desktop-name-portal-identity
Aug 17, 2026
Merged

VerteDinde merged 3 commits into
mainfrom
docs-desktop-name-portal-identity

Conversation

@VerteDinde

@VerteDinde VerteDinde commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Description of Change

desktopName sets CHROME_DESKTOP, which on Linux becomes the Wayland app_id / X11 WM_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 .desktop file's basename
  • docs/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), the desktopName requirement, and the register()-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

  • PR description included and stakeholders cc'd
  • PR title follows semantic commit guidelines

Release Notes

Notes: none

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Jul 1, 2026
@VerteDinde VerteDinde added target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Jul 2, 2026
@VerteDinde VerteDinde changed the title docs: desktopName is the Linux portal identity; document the Wayland shortcut flow docs: document Linux portal identity / Wayland shortcut flow Jul 2, 2026
…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.
@VerteDinde
VerteDinde force-pushed the docs-desktop-name-portal-identity branch from 0c3f2c6 to 3ebd057 Compare July 2, 2026 02:19

@mitchchn mitchchn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just had some thoughts on trimming out details that devs might not need to focus on.

Comment thread docs/api/app.md Outdated

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread docs/api/app.md Resolved
Comment thread docs/api/app.md Resolved
Comment thread docs/api/global-shortcut.md Resolved
Comment thread docs/api/app.md
Comment on lines +734 to +736
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we adjust the default implementation to be portal friendly ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, then it would be good to have a tracking issue to flip the default implementation.

@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Jul 2, 2026
@MarshallOfSound

Copy link
Copy Markdown
Member

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 main (or "Update branch") picks up the change, nothing else needed.

- 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
@VerteDinde
VerteDinde merged commit 97ac602 into main Aug 17, 2026
45 checks passed
@release-clerk

release-clerk Bot commented Aug 17, 2026

Copy link
Copy Markdown

No Release Notes

@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #52889

@trop trop Bot added in-flight/44-x-y and removed target/44-x-y PR should also be added to the "44-x-y" branch. labels Aug 17, 2026
@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #52890

@trop trop Bot added in-flight/43-x-y merged/44-x-y PR was merged to the "44-x-y" branch. and removed target/43-x-y PR should also be added to the "43-x-y" branch. in-flight/44-x-y labels Aug 17, 2026
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. and removed in-flight/43-x-y labels Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. semver/none

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants