asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)
MIT License
4.9k stars 344 forks source link

how to change icon for windows application #401

Closed asdfsx closed 10 months ago

asdfsx commented 10 months ago

I'm trying to build windows application on macOS, and I met a problem that the icon of the application can not change.

I build the application with the command astilectron-bundler -c "bundler-win.json" -ldflags "-linkmode external -extldflags -static", and the bundler.json is like below

{
  "app_name": "desktop",
  "icon_path_darwin": "resources/icon.icns",
  "icon_path_linux": "resources/icon.png",
  "icon_path_windows": "resources/icon.ico",
  "environments": [
    {
      "arch": "amd64", 
      "os": "windows",
      "env": {
        "CC": "x86_64-w64-mingw32-gcc",
        "CXX": "x86_64-w64-mingw32-g++",
        "CGO_ENABLED": "1"
      }
    }
  ]
}

But the icon always be image So I want to know how to update the icon for the windows application.

asticode commented 10 months ago

Did you change the icon located at resources/icon.ico?

asdfsx commented 10 months ago

yes, I have change the icon.

When I use regular icon or extra large icon in file explorer, the application show as image

When I use medium icon, the application show the icon I replaced image

Now I'm very confused about this

asdfsx commented 10 months ago

I think the problem is caused by the ico file I make. And the windows icon cache made the problem more confuse. After I recreate the ico file and clean the cache, the problem solved.