mix3d
mix3d

Reputation: 4333

Why is the app name displayed in "about" Menu different than App name? (Electron, MacOS)?

I'm using electron-forge, and have my app building, bundling, and running well, so I'm in the customize and polish state (set app icon, name etc).

I was able to set the .app bundle name, and the name displayed in the top-level menu, but for some reason, the package.json name field is still being applied in two areas (see image below). I opened the app bundle to look at the Info.plist, but did not see any instances of 'omni-desktop-test'.

What setting am I missing to target these values?

Example issue

Relevant part of my forge config:

packagerConfig: {
    name: 'Keystone Omni',
    productName: 'Keystone Omni',
    executableName: 'Keystone Omni Desktop',
    icon: 'assets/app.icns',
    appBundleId: 'com.xxxxxxx.omni',
    appCategoryType: 'public.app-category.developer-tools',
    extendInfo: 'static/info.plist',
}

Upvotes: 5

Views: 2841

Answers (2)

mix3d
mix3d

Reputation: 4333

While testing and attempting to make a bug report to electron-forge, I discovered the following:

  1. The productName that is referred to here: https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#name is intended to be in the package.json file, not in the electron-packager config. I had not seen 'productName' as a value in package.json before.

The application name. If omitted, it will use the 'productName' or 'name' value from the nearest package.json.

  1. Even if you set 'name' in the electron-packager config, it will still read the package.json's 'productName' value (or 'name' value, if not defined), for the text in the problem areas.

So the answer is, if you want this set at the bundler level:

Use 'name' in the packager config to set the top-level display name, and 'productName' (or 'name' as a fallback) in the package.json to set the sub-menu about, hide, quit, etc items.

Upvotes: 5

kennyvh
kennyvh

Reputation: 2854

In your electron Main.js file, use app.setName to change your app's name:

app.setName('Keystone Omni');

Upvotes: 6

Related Questions