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 AppImage icon does not show up #2269

Closed
moughxyz opened this issue Nov 6, 2017 · 11 comments
Closed

Linux AppImage icon does not show up #2269

moughxyz opened this issue Nov 6, 2017 · 11 comments
Labels

Comments

@moughxyz
Copy link

moughxyz commented Nov 6, 2017

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.

@develar
Copy link
Member

develar commented Nov 6, 2017

Related: #748 (comment)

@develar
Copy link
Member

develar commented Nov 6, 2017

How do you start app? From menu or by clicking on file?

@moughxyz
Copy link
Author

moughxyz commented Nov 6, 2017 via email

@develar
Copy link
Member

develar commented Nov 6, 2017

Duplicates #748

@develar develar closed this as completed Nov 6, 2017
@moughxyz
Copy link
Author

moughxyz commented Nov 6, 2017

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?

@moughxyz
Copy link
Author

moughxyz commented Nov 6, 2017

Oh wow, actually, this worked:

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

@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

@szTheory
Copy link

This fixed it for me if someone wants to see a live example in an open source app here is the commit szTheory/exifcleaner@8a129a1

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

@puresick
Copy link

puresick commented May 7, 2020

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

@puresick
Copy link

There seems to be a new issue opened about this: #4617

@szTheory
Copy link

I needed to do this to the path to get it to work .replace(/\\/g, '\\\\'); Found on this PR NicolasConstant/sengi#324

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
jyyi1 added a commit to Jigsaw-Code/outline-apps that referenced this issue May 23, 2022
Our app's icon is not shown in Ubuntu Dock (on Windows it is fine):

<img width="438" alt="image" src="https://user-images.githubusercontent.com/93548144/169601560-13dc6d59-9f36-490a-ac9f-60bc5744a593.png">

Similar issues are reported to electron-builder (e.g., electron-userland/electron-builder#2269). Though the issue is declared to be "fixed", it is actually not, people are still using the workaround of setting main windows's icon in electron code.

In this fix, I use the workaround mentioned above which is to forcibly set the window icon to the 64x64 icon image. The following images illustrate the icon displayed under 100%, 150% and 200% dpi settings:

<img width="438" alt="image" src="https://user-images.githubusercontent.com/93548144/169601854-30b74190-d3cb-4c98-9550-8eec932adb20.png">

<img width="657" alt="image" src="https://user-images.githubusercontent.com/93548144/169601965-f101b3fd-49bf-4568-a571-dead88bd1681.png">

<img width="866" alt="image" src="https://user-images.githubusercontent.com/93548144/169602052-d5f931b7-421d-4f8a-acde-3456d8569bea.png">

I did not set the icon to 128x128 because it actually looks too sharp under the regular DPI setting (100%), here a comparison between 64x64 and 128x128 under 100% dpi (though in higher dpi's, the 128x128 looks better):

<img width="438" alt="image" src="https://user-images.githubusercontent.com/93548144/169601854-30b74190-d3cb-4c98-9550-8eec932adb20.png">

<img width="423" alt="image" src="https://user-images.githubusercontent.com/93548144/169602791-15875358-40b8-4052-9ff8-8cc428ac4157.png">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants