question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to set icon on Linux target

See original GitHub issue
  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:

I’m building on Ubuntu 16.04 for x64, and while simply running the app will show the icon just fine, the icon once packaged is always the electron icon. I have verified that the icon path is a valid one.

Console output when you run electron-packager with the environment variable DEBUG=electron-packager. Please include the stack trace if one exists.

  electron-packager Electron Packager 8.6.0 +0ms
  electron-packager Node v7.7.3 +2ms
  electron-packager Host Operating system: linux (x64) +0ms
  electron-packager Packager Options: {"name":"pman","appname":"pman","arch":"x64","platform":"linux","icon":null,"version":"1.6.5","dir":"/home/ryan/Documents/Development/bplayer4/dist","sourcedir":"/home/ryan/Documents/Development/bplayer4/dist","out":"/home/ryan/Documents/Development/bplayer4/dist/releases","overwrite":true,"asar":false,"prune":true,"app_version":null,"afterCopy":[null],"afterExtract":[]} +0ms
  electron-packager Target Platforms: linux +0ms
  electron-packager Target Architectures: x64 +1ms
WARNING: The version parameter is deprecated, use electronVersion (or --electron-version in the CLI) instead
  electron-packager Inferring appVersion from version in /home/ryan/Documents/Development/bplayer4/dist/package.json +9ms
  electron-packager Application name: pman +0ms
  electron-packager Target Electron version: 1.6.5 +0ms
  electron-packager Downloading Electron with options {"platform":"linux","arch":"x64","version":"1.6.5"} +4ms
Packaging app for platform linux x64 using electron v1.6.5
  electron-packager Creating /tmp/electron-packager/linux-x64-template +319ms
  electron-packager Extracting /home/ryan/.electron/electron-v1.6.5-linux-x64.zip to /tmp/electron-packager/linux-x64-template +1ms
  electron-packager Initializing app in /tmp/electron-packager/linux-x64/pman-linux-x64 from /tmp/electron-packager/linux-x64-template template +1s
  electron-packager Ignored paths based on the out param: +1ms [ '/home/ryan/Documents/Development/bplayer4/dist/releases' ]
  electron-packager Running npm prune --production +3s
  electron-packager Renaming electron to pman in /tmp/electron-packager/linux-x64/pman-linux-x64 +5s
  electron-packager Moving /tmp/electron-packager/linux-x64/pman-linux-x64 to /home/ryan/Documents/Development/bplayer4/dist/releases/pman-linux-x64 +0ms

What command line arguments are you passing? Alternatively, if you are using the API, what parameters are you passing to the packager() function?

I’m using the API, but my options argument is generated programmatically and is thus pretty tricky to post here. I’ve resorted to simply not setting the ‘icon’ property. The only reason I’m posting the issue here is that the icon works fine before I package the app, so I’m pretty sure it must be an issue with electron-packager and not with electron. Is there any way I could fix this, or is there some magical way to set the icon post-packaging that will work? The icon works everywhere else.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zxdong262commented, Oct 27, 2017

same issue, solved with --icon option,

exec(`${bin}/electron-installer-debian --src ${dir}/${name}-linux-x64 --dest ${dir}/installers/ --arch amd64 --icon ${dir}/${name}-linux-x64/resources/app/static/images/electerm-round-128.png`)

and I have set the icon option too, but without the --icon option will not work.

  // Create the browser window.
  win = new BrowserWindow({
    width,
    height,
    fullscreenable: true,
    //fullscreen: true,
    icon: resolve(__dirname, 'static/images/electerm-round-128.png')
  })
    "electron": "1.7.8",
    "electron-builder": "19.22.1",
0reactions
maleptcommented, Apr 19, 2017

I would see what the path returned with app.getAppPath is and then see if the path you created for the icon actually exists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how i can set icon application in ubuntu with elctron builder
The Linux icon set will be generated automatically based on the macOS icns file (or you can put them into the build/icons directory...
Read more >
App icon doesn't appear in Linux - Help - OpenFL Community
I can't get my app icon to show up in the Linux cpp target. I've tried specifying an svg and specifying various sizes...
Read more >
Unable to set custom icon on application launcher - Ask Ubuntu
I am using Ubuntu 10.10 and having trouble setting a custom icon for an application launcher that I created. I have created and...
Read more >
Electron .net. How to set console app icon in linux. - CodeProject
Here is setting in electron. manifest. json file. , "linux": { "target": "AppImage", "icon": "build/icons/linux-256x256.
Read more >
Squirrel.Windows - electron-builder
Windows. The top-level squirrelWindows key contains set of options instructing electron-builder on how it should build Squirrel.Windows. Squirrel.Windows target ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found