electron / electron/forge

Use desktopName to create the .desktop file for Linux packages

Open
#4,313 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

### Problem description

Electron uses the `desktopName` property in `package.json` to determine the XDG App ID: https://www.electronjs.org/docs/latest/api/app#appsetdesktopnamename-linux. This value is supposed to match the base name of the .desktop file installed for the app, e.g.

- XDG app ID: `com.company.MyApp`
- File: `/usr/share/applications/com.company.MyApp.desktop`

If the XDG App ID doesn't match the filename, desktop environments on Wayland may not be able be able to match icons, keyboard shortcuts, and other portals.

### Proposed solution

If `desktopName` is set in package.json, forge should use it as the basename for the .desktop file it creates.

Ideally, Forge would also show a warning if the value is not set when building Linux targets. A matching App ID is becoming more important in modern desktop environments. Ideally, it should be a FQDN e.g. `com.company.MyApp`.

### Alternatives considered

Forge will currently produce a .desktop file based on the executable name or product name even if `desktopName` is set. These are not really suitable options especially given the move toward FQDNs.

### Additional information

Related to https://github.com/electron/electron/pull/52222.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.