Hello, I've been using electron-builder for about a year now. It's made my life tremendously easier.
Users have reported this issue for a long time, and I thought it was some user error. But no matter what I've tried, I can't get the app icon to show up in any Linux distro. I've tested on Ubuntu and Fedora.
Here is what it shows (bottom):
Root package.json:
"build": {
"linux": {
"category": "Office",
"icon": "build/icon/",
"target": [
"AppImage",
"deb"
]
}
}
My build
folder in root:
build/
βββ icon
βΒ Β βββ Icon-512x512.png
βββ icon.icns
βββ icon.ico
My app/package.json does not have any icon related metadata. Should it?
Any other info I can share that might be helpful?
Here is the app repo: https://github.com/standardnotes/desktop/tree/backups
Using electron-builder 19.45.0.
How do you start app? From menu or by clicking on file?
From the command line. Because thereβs no way to click on AppImage to open
it.
chmod a+x standard-notes---.AppImage
./standard-notes---.AppImage
Then Ubuntu asks if I want to save it to launcher, and I say yes. But
then the icon is missing.
Duplicates #748
So I'm not sure I'm following: does this mean if the user launches it via the command line, it is impossible to show an icon? Or does adding an icon
property in the BrowserWindow config fix this?
Oh wow, actually, this worked:
win = new BrowserWindow({
...
icon: path.join(__dirname, '/icon/Icon-512x512.png')
})
I am facing exactly the same issue. I tried everything suggested in this thread but unfortunately, nothing worked. App icon only works with deb but not with AppImage. Is anyone able to point me in the right direction?
electron-builder: 21.2.0
electron: 3.1.13
This fixed it for me if someone wants to see a live example in an open source app here is the commit https://github.com/szTheory/exifcleaner/commit/8a129a124d58c21b1f0aff3a79326b8b2d1ebf25
const createMainWindow = async function() {
let options = {
title: app.name,
show: false,
width: DEFAULT_WINDOW_WIDTH,
height: DEFAULT_WINDOW_HEIGHT + 25,
minWidth: DEFAULT_WINDOW_WIDTH,
minHeight: DEFAULT_WINDOW_HEIGHT + 25,
webPreferences: { nodeIntegration: true }
};
if (is.linux) {
options = Object.assign({}, options, {
icon: path.join(__dirname, "../../exifcleaner.png")
});
}
return new BrowserWindow(options);
};
Oh wow, actually, this worked:
win = new BrowserWindow({ ... icon: path.join(__dirname, '/icon/Icon-512x512.png') })
This issue still exists and the only way I got an icon shown when bundling as AppImage is like the comment above from 2017. I also had to name it exactly like above to get it to work.
System:
There seems to be a new issue opened about this: https://github.com/electron-userland/electron-builder/issues/4617
I needed to do this to the path to get it to work .replace(/\\/g, '\\\\');
Found on this PR https://github.com/NicolasConstant/sengi/issues/324
Most helpful comment
Oh wow, actually, this worked: