4

The app logo is properly shown everywhere else but in the notification section where it displays an empty logo

enter image description here

I know that you can add a custom image for the notification passing a icon property like so:

           new Notification({
              title: 'Test Notification',
              body: 'This is a test notification',
              icon: path.join(__dirname, 'icon.ico'),
            });

But that's not the logo I want to change.

The app when built also shows the correct logo elsewhere:

enter image description here

I also added an icon property when creating the BrowserWindow like advised here.

  const win = splashWindow = new BrowserWindow({
    width: 320,
    height: 320,
    // more 
    icon: path.resolve(__dirname, 'icon.ico'),
  });

Adding a

win.setIcon(path.resolve(__dirname, 'icon.ico');

doesn't work too.

This code is all in main.js.

And I've been checking the docs for the App class and there's a getFileIcon but it doesn't appear to be related to this.

May be related?

I have been able to modify the app name to 'Awesome App' via setAppUserModelId like so:

ipcMain.on('app-ready', () => {
  if (process.platform === 'win32') {
    // somehow also change logo here? can't find it in the docs
    app.setAppUserModelId('Awesome app');
  }
Fer Toasted
  • 1,274
  • 1
  • 11
  • 27

2 Answers2

3

I call app.setAppUserModelId('xxxx') before new Notification and it works.

xxxx is your bundle id.

fental
  • 51
  • 5
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 30 '22 at 04:44
  • I do this right before launching any `BrowserWindow`. – Fer Toasted Jan 13 '23 at 16:00
0
    i have used below changes.
inside package.json --> add below. make sure to add  "appId": "YOUR APP NAME"
    "win": {
      "target": "nsis",
      "icon": "logo256.ico",
      "appId": "YOUR APP NAME"
    }


also make sure to add 
app.on("ready", ev => {
  if (process.platform == 'win32') {
    app.setAppUserModelId('YOUR APP NAME');
  }
}
praveen
  • 226
  • 2
  • 5