Electron-builder: Linux AppImage icon does not show up

Created on 6 Nov 2017  Β·  11Comments  Β·  Source: electron-userland/electron-builder

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):

screen shot 2017-11-05 at 7 24 10 pm

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.

AppImage

Most helpful comment

Oh wow, actually, this worked:

win = new BrowserWindow({
   ...
   icon: path.join(__dirname, '/icon/Icon-512x512.png')
})

All 11 comments

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:

  • Latest Arch Linux
  • Gnome 3.36.2
  • electron-builder 22.5.1

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

Was this page helpful?
0 / 5 - 0 ratings