Skip to content

Use desktopName from package.json for StartupWMClass in Linux desktop entries#9574

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-desktop-name-issue
Draft

Use desktopName from package.json for StartupWMClass in Linux desktop entries#9574
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-desktop-name-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 8, 2026

Electron derives app_id from desktopName in package.json, but electron-builder was hardcoding StartupWMClass to productName. This mismatch prevents desktop environments from associating windows with their .desktop entry (wrong icons, missing taskbar integration, etc.).

For example, Signal Desktop has desktopName: "signal.desktop", productName: "Signal", and executableName: "signal-desktop" — three different values where StartupWMClass and app_id must agree.

Changes

  • options/metadata.ts — Add desktopName to the Metadata interface
  • LinuxTargetHelper.ts — Read desktopName from package.json, strip .desktop suffix, and use as StartupWMClass. Falls back to productName when unset (backward compatible)
  • Test + snapshot — Validates that desktopName: "signal.desktop" produces StartupWMClass=signal
// package.json
{
  "name": "signal-desktop",
  "productName": "Signal",
  "desktopName": "signal.desktop"
}
# Before: StartupWMClass=Signal
# After:  StartupWMClass=signal
Original prompt

This section details on the original issue you should resolve

<issue_title>desktopName is ignored when generating desktop entry</issue_title>
<issue_description>Discovered while investigating signalapp/Signal-Desktop#6239.

Electron sets the app_id of the app based on the desktopName entry in package.json when provided, see here.

According to electron/electron#34855 (comment) both WM_CLASS and app_id should be the same as the desktop entry filename, however, electron-builder sets the WM_CLASS to productName and the filename is based on executableName.

args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`)

In case of Signal Desktop this means that the desktop filename is signal-desktop.desktop, the WM_CLASS is Signal while app_id is signal. This causes issues with desktop environments being unable to associate the correct icon with the app signalapp/Signal-Desktop#6122.</issue_description>

Comments on the Issue (you are @copilot in this section)

@mmaietta Is this a new change in electron? I didn't know of there being a `desktopName` field in `package.json`

Looking to start a conversation here. What's the expected resolution? It sounds like that StartupWMClass might need to default to appInfo.desktopName or something similar (once we pull desktopName from the package.json), then have a fallback to appInfo.productName?

Would that resolve this or do we also need to change the .desktop filename as well? I didn't notice anything implying the latter.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 8, 2026

⚠️ No Changeset found

Latest commit: 6b8f2ca

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

… entry

When desktopName is set in package.json, use it (with .desktop extension
stripped) as the StartupWMClass value in the generated desktop entry file.
This ensures the WM_CLASS matches Electron's app_id, which is also derived
from desktopName, allowing desktop environments to properly associate
windows with their desktop entries.

Falls back to productName when desktopName is not set.

Fixes #7159

Co-authored-by: mmaietta <5238867+mmaietta@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix desktopName handling for desktop entry generation Use desktopName from package.json for StartupWMClass in Linux desktop entries Feb 8, 2026
Copilot AI requested a review from mmaietta February 8, 2026 14:16
@mmaietta
Copy link
Copy Markdown
Collaborator

@copilot rebase this PR

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 18, 2026

@copilot rebase this PR

I'm unable to rebase this PR because rebasing requires force pushing, which I don't have the ability to do. Could you rebase it manually, or alternatively, I can recreate the changes on top of the latest base branch if you'd prefer.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

desktopName is ignored when generating desktop entry

2 participants