Electron-builder: AppImage icon not working

Created on 27 Jan 2020  路  14Comments  路  Source: electron-userland/electron-builder


  • Version:
    21.2.0

  • Target:
    linux, Appimage


As stated in the docs:

Since electron-builder 21 desktop integration is not a part of produced AppImage file. AppImageLauncher is the recommended way to integrate AppImages.

I'm not a big fan of this decision but it for sure has reasons, idk.
I tried out linux mojave (arch linux) and installed the appimagelauncher to integrate the AppImage, Sadly there is no icon in the start menu.

The AppImage docs say the icon file has to be in <root>/usr/share/icons/<theme>/<resolution>/apps/myapp.<ext>, I extracted the AppImage generated by electron-builder and the icon file in there symlinks to usr/share/icons/hicolor/scalable/myapp.svg, as you see /apps is missing, this might be the cause?

Most helpful comment

IT IS RELEVANT!

All 14 comments

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Yes it is still relevant.
Whats blocking it? well nobody seems to care.

@Coding-Kiwi I have no idea how to resolve this on AppImage level, but I just applied a workaround to my project, which I found by looking at other open source projects.

  1. Add a "static" folder to your Electron project

image

  1. Add some icons to the static folder in png format. I found that a 64x64 png icon looked best in the docks in Linux. Larger sizes are jagged. You can also add a windows icon in .ico format.

  2. In you main.ts, add this:

import * as os from 'os';

const globalAny: any = global; // If you use TypeScript, Global does not allow setting custom properties.

// Static folder is not detected correctly in production
if (process.env.NODE_ENV !== 'development') {
  globalAny.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\');
}

Then, when creating the BrowserWindow, you can reference the icons:

mainWindow = new BrowserWindow({
      'x': 50,
      'y': 50,
      'width': 500,
      'height': 500,
      backgroundColor: '#fff',
      icon: path.join(globalAny.__static, os.platform() === 'win32' ? 'icons/icon.ico' : 'icons/64x64.png'),
      show: false
    });

I am having the same issue with AppImages not showing any Icon, except with the workaround described in https://github.com/electron-userland/electron-builder/issues/2269

It differs from the workaround described above by digimezzo in the fact that I needed to name my icon a specific way, regardless the icons resolution: "Icon-512x512.png"

It seems I have the same issue...

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

IT IS RELEVANT!

I've set the icon path in the window settings and it shows the icon in the Ubuntu dock,
but the AppImage file itself doesn't have an icon. I don't know if that's a linux limitation?

image

bump

version 20.44.4 is the last version which can generate a desktop file, since 21.0.0, the desktop file is no longer generated

image

@qishibo thats what I wrote in the issue description.
AppImageLauncher is inconvenient for the user and a lazy excuse by electron-builder, but even when I tried to use AppImageLauncher I could not get it to work because of wrong paths

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

201316111820369728

Why has this issue been closed @develar?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omarkilani picture omarkilani  路  3Comments

JohnWeisz picture JohnWeisz  路  3Comments

lbssousa picture lbssousa  路  3Comments

talarari picture talarari  路  3Comments

AidanNichol picture AidanNichol  路  3Comments