2179

Electron — Can't get custom icon to appear

Question:

I'm having an issue setting the icon for my Electron app in two different ways:

<strong>Non-Packaged (Running the app via terminal)</strong>

My main.js does specify an 'icon' value, pointing to the icon file, but it does not apply.

<strong>Packaged (with electron-packager)</strong>

My package.json file specifies the 'icon' key, pointing to the icon file, and I have the .icns (Mac) file in the <em>build</em> directory. I used electron-packager to build the app, but the icon is not applied, the default electron icon is used instead.

Not sure what I'm doing wrong here, everything appears correct.

Answer1:

There is a good tutorial here:

<ul><li><a href="https://www.christianengvall.se/electron-app-icons/" rel="nofollow">https://www.christianengvall.se/electron-app-icons/</a></li> </ul>

Follow the steps but make sure you don't skip anything.

This is also a relevant issue on GitHub:

<ul><li><a href="https://github.com/electron-userland/electron-builder/issues/289" rel="nofollow">https://github.com/electron-userland/electron-builder/issues/289</a></li> </ul>

More links here:

<ul><li><a href="https://discuss.atom.io/t/changing-electron-app-icon-and-information/18631" rel="nofollow">https://discuss.atom.io/t/changing-electron-app-icon-and-information/18631</a></li> </ul>

Answer2:

You can add this script to package.json and it works perfectly fine. Mostly its because of the path issues.

"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",

Recommend

  • How to refresh browser view in finder window(mac os 10.5)?
  • KRL RSS parser: Handle encoding issues?
  • Simple way to get more sensible colors in gscatter
  • Is the scope of a variable initialized in a for loop declaration actually more than just block scope
  • SUM and GROUP BY in xquery with 1 xml file
  • Java Date object constructor for getting string is deprecated
  • How can I sum two different columns at once where one contains Decimal objects in pandas?
  • Capturing HTML Text Input Key press after key has been applied?
  • Implementing HMAC-SHA256 for Keybase in Javascript
  • Objective C - Create a framework for my iphone apps?
  • How to have a website splash screen (web app)
  • Which browser have this strange user agent? (IOS device)
  • How gzip file gets stored in HDFS
  • Web.config system.webserver errors
  • Install PHP intl extension on MacOS
  • How to have background script and something similar to a default popup?
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • Play WS (2.2.1): post/put large request
  • PostgreSQL Query without WHERE only ORDER BY and LIMIT doesn't use index
  • Checking free space on FTP server
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Change Inet root folder for iis 7
  • Paperclip, set path outside of rails root folder
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Different response to non-authenticated users and AJAX calls
  • RectangularRangeIndicator format like triangular using dojo
  • Cross-Platform Protobuf Serialization
  • Modifying destination and filename of gulp-svg-sprite
  • Updated Ionic CLI but shows previous version (Windows)
  • Convert array of 8 bytes to signed long in C++
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • GridView Sorting works once only
  • Revoking OAuth Access Token Results in 404 Not Found
  • -fvisibility=hidden not passed by compiler for Debug builds
  • Is it possible to post an object from jquery to bottle.py?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Recursive/Hierarchical Query Using Postgres
  • UserPrincipal.Current returns apppool on IIS
  • Net Present Value in Excel for Grouped Recurring CF