I am new to electronjs. I want to convert an angular app to desktop. I could achieve it successfully but the problem is that the app icon is set to default electron and not the icon I provided as follows:
win = new BrowserWindow({
width: 600,
height: 670,
icon: `${__dirname}/dist/assets/imgs/logo.png`
})
I changed the icon after building the app using resource hacker but what I need is to change it at build time in the correct way. what am I missing>
I get a problem that electron always shows default app icon. I tried using png, NativeImage, different icon sizes but still the problem Go to node_modules -> electron -> dist, right click on Electron, choose View Info icon must be specified with __dirname (we already did) for electron-packager to pick up correct icons
I tried using png, NativeImage, different icon sizes but still the problem Go to node_modules -> electron -> dist, right click on Electron, choose View Info icon must be specified with __dirname (we already did) for electron-packager to pick up correct icons Build a Desktop app with Gridsome and Electron.
The icon should be called icon.png or icon.ico and it should be at least 256x256 in Windows. The icon should be called icons.icns or icon.png at it should be at least 515x512 in macOS. After placing the icon into the build folder, run the following command: electron-builder will look for an icon into the /build folder and replace it with your icon.
After placing the icon into the build folder, run the following command: electron-builder will look for an icon into the /build folder and replace it with your icon. The use of npx rather than npm will prevent to install electron-builder as a dependency; it will run the package directly in the terminal.
In main.js, specify icon
win = new BrowserWindow({
width: 800,
height: 600,
icon: __dirname + '/Icon/Icon.icns'
})
You can also use helper url methods
const path = require('path')
const url = require('url')
const iconUrl = url.format({
pathname: path.join(__dirname, 'Icon/Icon.icns'),
protocol: 'file:',
slashes: true
})
Check this for reference: https://medium.com/fantageek/changing-electron-app-icon-acf26906c5ad
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With