Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppImage icon not working #4617

Closed
Coding-Kiwi opened this issue Jan 27, 2020 · 15 comments · Fixed by #5385
Closed

AppImage icon not working #4617

Coding-Kiwi opened this issue Jan 27, 2020 · 15 comments · Fixed by #5385

Comments

@Coding-Kiwi
Copy link

  • 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?

@stale
Copy link

stale bot commented Mar 27, 2020

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.

@stale stale bot added the backlog label Mar 27, 2020
@Coding-Kiwi
Copy link
Author

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

@digimezzo
Copy link

digimezzo commented May 3, 2020

@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
    });

@puresick
Copy link

I am having the same issue with AppImages not showing any Icon, except with the workaround described in #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"

@mahnunchik
Copy link
Contributor

It seems I have the same issue...

@stale
Copy link

stale bot commented Jul 27, 2020

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.

@stale stale bot added the backlog label Jul 27, 2020
@mahnunchik
Copy link
Contributor

IT IS RELEVANT!

@stale stale bot removed the backlog label Jul 27, 2020
@itsjavi
Copy link

itsjavi commented Aug 7, 2020

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

@martin-juul
Copy link

bump

@qishibo
Copy link

qishibo commented Sep 9, 2020

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

@Coding-Kiwi
Copy link
Author

@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

@stale
Copy link

stale bot commented Nov 9, 2020

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.

@stale stale bot added the backlog label Nov 9, 2020
@mahnunchik
Copy link
Contributor

201316111820369728

@stale stale bot removed the backlog label Nov 9, 2020
@puresick
Copy link

Why has this issue been closed @develar?

@amcolash
Copy link

amcolash commented Mar 9, 2021

Pretty sure this is why things have not been working consistently for a while (2017): AppImage/AppImageKit#346

BrunoBernardino added a commit to padloc/padloc that referenced this issue Feb 24, 2022
I can't build this locally over some strange permissions issue. I'm pushing to try if it works on CI.

I've tried many suggestions mentioned in the following PRs, but nothing worked. This one seems to at least try to do something about the icns file, though it's failing locally, like I said:

- electron-userland/electron-builder#748
- electron-userland/electron-builder#2269
- electron-userland/electron-builder#4617
- electron-userland/electron-builder#5385
- electron-userland/electron-builder#2577 (comment)

Related to #123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants