2

I'm having trouble changing my electron app icon.

mainWindow = new BrowserWindow({
    width: 1280,
    height: 960,
    frame: false,
    icon: __dirname + 'img/joe.icns',
    webPreferences: {
      nodeIntegration: true,
      enableRemoteModule: true,
      // worldSafeExecuteJavaScript: true,
      // contextIsolation: true,
    },

I've referenced stackoverflow and medium.com for my attempt.

I have also attemptted

icon: __dirname + 'src/img/joe.icns',
icon: __dirname + './img/joe.icns',

and other similar structure names.

Directory Structure

2 Answers2

3

Try this:

icon: path.join(__static, 'joe.icns'),

And put the icon in ./dist_electron/bundled and ./public

Majed Badawi
  • 27,616
  • 4
  • 25
  • 48
1

Referencing stackoverflow, I assumed .icns (icon set) was the only extension allowed for electron apps. Reading Stackoverflow2 provided by @deniz, I've realized ico file type was also available and gave it a try, and it worked. I assumed icns was a complex icon file type, and my icns file was probably not compatible with electron app. Thank you (and sorry) for the effort @Majed Badawi.

icon: __dirname + '/img/joe.ico',