Stream Summer
Stream Summer

Reputation: 83

How do I change the icon for Electron app

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

Upvotes: 2

Views: 4184

Answers (2)

Stream Summer
Stream Summer

Reputation: 83

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',

Upvotes: 1

Majed Badawi
Majed Badawi

Reputation: 28434

Try this:

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

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

Upvotes: 3

Related Questions