Use desktopName to create the .desktop file for Linux packages
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- 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.
Source: electron/forge