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

Linux icons issue #2577

Closed
romangetman opened this issue Feb 13, 2018 · 43 comments · Fixed by #5385
Closed

Linux icons issue #2577

romangetman opened this issue Feb 13, 2018 · 43 comments · Fixed by #5385

Comments

@romangetman
Copy link

  • Version: 20.0.4
  • Target: deb, AppImage

No matter what I try I cannot set an icon on Linux.
Building from a macOS Sierra.
I have dir's customized:

"directories": {
      "buildResources": "./build_res",
      "output": "./build",
      "app": "./dist"
    }

I've tried setting

"linux": {
      "icon": "..."
}

to all imaginable values, copying all icon folders to different locations in the root and build_res and I still get a question mark icon in Ubuntu 16.04.

I have an .icns file in ./build_res/icon.icns.

Is there a workaround? Or a fix?

@develar
Copy link
Member

develar commented Feb 13, 2018

Do you run app using file (AppImage) or using menu? Set env DEBUG=electron-builder and you will see stage dir for AppImage (_appImage), where some icon will be in the root — is it your icon?

@romangetman
Copy link
Author

romangetman commented Feb 13, 2018

Running the AppImage by clicking on it directly.

Yes there's a symlink that is linked to __appImage-ia32/usr/share/icons/hicolor/512x512/apps/myicon.png.

What about the deb?

@develar
Copy link
Member

develar commented Feb 13, 2018

Running the AppImage by clicking on it directly.

Please see #748 (comment)

What about the deb?

Need to check.

@gschier
Copy link

gschier commented Feb 13, 2018

I've got the same issue. Defaults to Electron icon for both AppImage and deb builds. I also have custom dirs specified. Note: the same configuration worked in many previous versions of electron-builder.

@develar
Copy link
Member

develar commented Feb 13, 2018

@gschier I am sure that you issue is different. Please open a new issue and please set env DEBUG=electron-builder and attach log of the terminal output.

@gschier Or, if __appImage dir contains correct icon, your issue is the same :)

@gschier
Copy link

gschier commented Feb 13, 2018

Ya, looks like there is no icon at all in the root. Just an app and usr dir. Going to revert to a previous working version for now, but will create an issue next time I try and upgrade if I still have problems.

Thanks! This project is the best 😄

@develar
Copy link
Member

develar commented Feb 13, 2018

@gschier I will try to find time to checkout your project and investigate what's wrong.

@develar
Copy link
Member

develar commented Feb 13, 2018

@gschier Are you sure that you use 20.0.4?

@gschier
Copy link

gschier commented Feb 13, 2018

From the testing I just did, the icon stopped working after upgrading from 19.47.1 to 19.53.0. I also quickly tried 20.0.4 but ran into some different errors (vague message about JSON schema).

Error: no schema with key or ref "http://json-schema.org/draft-07/schema#"

Let me know if you need anything from me to help debug the issue. I'm AFK now but I can submit an issue for it tomorrow so we can continue the discussion there.

@nukeop
Copy link

nukeop commented Feb 13, 2018

I can't set an icon on Linux either, using any of the methods listed in the docs. Implicit conversion from .icns, setting it explicitly as icon.png or 1024x1024.png, or setting buildResources, or providing icon names, or copying the icons to all imaginable locations, all these methods just don't work. I'm using 20.0.4 now.

@nukeop
Copy link

nukeop commented Feb 13, 2018

@romangetman
Copy link
Author

romangetman commented Feb 14, 2018

I just tried rolling back to 19.47.1 on a hunch from @gschier which at first gave me an error that
icon directory doesn't contain icons.
That directory in my case was build_res/icons.
I put a 1024x1024.png there, the error went away, but still no icon in the deb installer.

@marbemac
Copy link

Confirmed on our end as well that linux deb icons work on 19.47.1, but not on 20.0.4.

@eafelix
Copy link

eafelix commented Feb 15, 2018

Same error here with the .deb package, How could I help guys?

@Qiplex
Copy link

Qiplex commented Feb 21, 2018

This happens for me while building snap on any version higher than 19.53.7 I'm using 20.0.7 now. After lots of errors and trials made it work with following config:

Variant 1

  "build": {
    "directories": {
        "output": "release-builds",
        "buildResources": "resources"
    },
    "linux": {
      "target": [
        "AppImage",
        "snap"
      ]
    }
$ tree resources

resources
└── icons
    ├── 1024x1024.png
    └── icon.png

Variant 2

    "directories": {
      	"output": "release-builds"
    },

    "linux": {
      "target": [
        "AppImage",
        "snap"
      ],
	"icon" : "icons/icon.png"
}

@develar
Copy link
Member

develar commented Feb 21, 2018

@Qiplex Simply create file icon.png in the resources (buildResources, defaults to build, in your case set to custom value) and nothing more.

@Qiplex
Copy link

Qiplex commented Feb 21, 2018

@develar yeah. It works now all the ways including the default one, you just mentioned about.

Strange thing is that I had build folder withicon.png for a long time and didn't customize configuration of electron-builder since it used to work nicely the way you described.

Until icon directory doesn't contain icons. issue appeared all of sudden in few previous versions of electron-builder after 19.53.7 on Mac & Ubuntu.

One thing I changed today was snapcraft upgrade on Mac brew upgrade snapcraft and icons issue gone. Maybe that was the case?

@develar
Copy link
Member

develar commented Feb 21, 2018

Maybe that was the case?

Definitely not.

This issue is still open because I didn't test mention cases (deb) manually. If someone can confirm that deb issue is gone in the 20.0.8 — will be great.

@develar
Copy link
Member

develar commented Mar 5, 2018

Please try 20.3.0. (#2654)

@develar develar closed this as completed Mar 5, 2018
@nukeop
Copy link

nukeop commented Mar 5, 2018

20.3.0 doesn't work either, but I can confirm that 19.47.1 does like @marbemac said earlier.

@develar develar reopened this Mar 5, 2018
@defusioner
Copy link

@IhorVimmi not working for me. I'm trying with the 256x256 icon that worked well for windows

@embbnux
Copy link
Contributor

embbnux commented Nov 28, 2019

In 22.2.0, have same issue. With linux deb, icon file can be found in /user/share/icons/hicolor, and icon works on Applications list. But fail on dock

@celodauane
Copy link

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

@victor-yon
Copy link

Same here, The icon works with Mac and Linux deb but doesn't with Linux AppImage.
It works with deb only if icon is a set directory but not with one png file (according to the documentation both should work).

@marcj
Copy link

marcj commented Mar 17, 2020

I can confirm. Still doesn't work with Linux (Ubuntu 18). I try with icns, folder, png path, with and without 1024x1024.png prefix. The only thing that worked in at least the window bar at the left of Ubuntu is manually adding the assets to the app "files": ["icons/**/*"] and then use it in new BrowserWindow({icon: __dirname+ '/icons/icon_1024x1024x.png'). However, the AppImage file in the file browsers and desktop still only shows this icon:
Screenshot 2020-03-17 at 04 24 39

Also what I find a bit unsexy is that the actual icon although in high resolution (1024x1024) appears very pixelated. Overall very unsatisfying tbh.

Screenshot 2020-03-17 at 04 26 58

//edit: the pixelated issue goes away if you install the app via the ubuntu package manager 🤷‍♂️

@BananaManCJ
Copy link

Anyone working on this? This should be an issue of high importance.

@embbnux
Copy link
Contributor

embbnux commented Apr 30, 2020

After adding icon option in BrowserWindow and including png files into build resources and files, it works now. This is commit ringcentral/ringcentral-embeddable-electron-app@29652ab

@mahnunchik
Copy link
Contributor

Any news?

@aeonthread
Copy link

i have the same issue

@aeonthread
Copy link

i have icon on snap and app image but not on deb file

@SimonBrandner
Copy link

SimonBrandner commented Jul 17, 2020

Hello,

I've had this problem myself. I've solved this in the following way.

This is the important part of package.json:

{
	"build": {
		"icon": "./assets/icons/512x512.png",
		"mac": {
			"icon": "./assets/icons/icon.icns"
		},
		"linux": {
			"icon": "./assets/icons/"
		}
	}
}

In the path ./assets/icons/ I have the following files: 512x512.png (this file is used for Windows and Linux) and icon.icns (this file is used for macOS). In the linux part of package.json I just specify the directory.

Here is the whole repository, in case this wasn't clear.

Hope I helped.

@bksubhuti
Copy link

bksubhuti commented Oct 18, 2020

i think if you point to the same file that mac requires (make it on the internet), then it will work. in your linux target.
"linux": {
"target": "deb",
"icon": "build/tpp-icon.icns"
},

@szTheory
Copy link

i think if you point to the same file that mac requires (make it on the internet), then it will work. in your linux target.
"linux": {
"target": "deb",
"icon": "build/tpp-icon.icns"
},

This did it for me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet