How to set app icon for Electron / Atom Shell App

前端 未结 9 1389
无人及你
无人及你 2020-11-29 17:00

How do you set the app icon for your Electron app?

I am trying BrowserWindow({icon:\'path/to/image.png\'}); but it does not work.

Do I need to p

相关标签:
9条回答
  • 2020-11-29 17:34

    You can do it for macOS, too. Ok, not through code, but with some simple steps:

    1. Find the .icns file you want to use, open it and copy it via Edit menu
    2. Find the electron.app, usually in node_modules/electron/dist
    3. Open the information window
    4. Select the icon on the top left corner (gray border around it)
    5. Paste the icon via cmd+v
    6. Enjoy your icon during development :-)

    Actually it is a general thing not specific to electron. You can change the icon of many macOS apps like this.

    0 讨论(0)
  • 2020-11-29 17:36

    Updated package.json:

    "build": {
      "appId": "com.my-website.my-app",
      "productName": "MyApp",
      "copyright": "Copyright © 2019 ${author}",
      "mac": {
        "icon": "./public/icons/mac/icon.icns",     <---------- set Mac Icons
        "category": "public.app-category.utilities"
      },
      "win": {
        "icon": "./public/icons/png/256x256.png" <---------- set Win Icon
      },
      "files": [
        "./build/**/*",
        "./dist/**/*",
        "./node_modules/**/*",
        "./public/**/*",       <---------- need for get access to icons
        "*.js"
      ],
      "directories": {
        "buildResources": "public" <---------- folder where placed icons
      }
    },
    

    After build application you can see icons. This solution don't show icons in developer mode. I don't setup icons in new BrowserWindow().

    0 讨论(0)
  • 2020-11-29 17:37

    For windows use Resource Hacker

    Download and Install: :D

    http://www.angusj.com/resourcehacker/

    • Run It
    • Select open and select exe file
    • On your left open a folder called Icon Group
    • Right click 1: 1033
    • Click replace icon
    • Select the icon of your choice
    • Then select replace icon
    • Save then close

    You should have build the app

    0 讨论(0)
提交回复
热议问题