Change Electron App icon in windows start menu

Viewed 3388

I want to change the default Electron icon to custom icon on all the places but i am unable to change in two places.

  1. The icon on the Windows start menu when we search the application
  2. The icon on the Windows taskbar

I have also tried a few solutions

mainWindow = new BrowserWindow({
    width: 1024,
    height: 768,
    resizable: false,
    icon: path.join(__dirname, 'src/app_64x64.png'),
  });

and

mainWindow.setOverlayIcon(path.join(__dirname, 'src/app_128x128.png'), 'Description for overlay');

but both the solutions are not working. Is there any way to change the icon?

Windows Task bar image

Window Application search image

2 Answers

if you are building the app with electron-builder module then add this

   "build": {
        "productName": "Your App Name",
        "win": {
            "target": "NSIS",
            "icon": "public/img/logo.ico"
          }
        }

in package.json

in addition to what Vishnu suggested: You can also just put icon.png file inside your buildResources folder. So, my electron.manifest.json looks like this:

"build": {
"appId": "ID",
"productName": "NAME",
"copyright": "Copyright",
"buildVersion": "1.0.0",
"compression": "maximum",
"directories": {
  "output": "../../../bin/Desktop",
  "buildResources": "./bin/_____"
},
"win": {
  "target": "nsis"
}

But be aware Windows seems to cache icons, it might be the reason why you don't see any changes. You can try to delete C:\Users%USER_NAME%\AppData\Local\IconCache and reboot your PC to see if it's a case.

Related