GTK4 Icons on Windows


I would like to give my application an icon and was trying to workout how to do it. This app is being created for Windows 11.

I have been reading as many posts on the forum as I can, but my lack of knowledge makes many of them indecipherable. Is there a step by step example somewhere that I can follow to add the application icon, similar to the repo by ToshioCP (I couldn’t find anything on there about this)?

Thank you.


Do you mean the icon in the window’s title bar or in the .exe file as shown in File Explorer?

I am porting my app Daikhan to Windows and I have recently added an icon for my app on Windows. You can see the changes I made in order to add that icon here. However if you do not need to generate the icon during build, you can get away with much less changes.

The porting process is not going smoothly due to electricity load shedding in my area but once the port is complete, I plan on writing a complete guide on how to port, build, and package LibAdwaita/GTK4 apps for Windows.


Hi @lb90,

Not so much the window title bar (would be nice to know how but at this point not a priority), more the executable icon and the application icon when in the taskbar. Currently the GTK icon gets shown in the taskbar and there is no icon for the executable.

I had previously set this in GTK3 with the set icon call but this has been removed in GTK4. I was poking around and it kind of seems like you could add icons to the resource xml file but would then need to rebuild GTK?

Thank you.

Hi @mazharhussain,

Thanks for that. I haven’t yet setup a meson build so was looking for a more direct way, I’m currently using VS2022 and including the required headers and libs (built from source using MSVC++). Based on what I have read on this forum and the GTK documentation using meson is the recommended approach. I have seen another where they seem to use GIMP to convert a png into a c struct then include it in the source and create a pixbuf object with it.

I look forward to seeing how you go about setting up the meson build process (I assume with MinGW) as this will likely make deployment a lot easier.

Thank you for your help.


Executable file icon

First create a Windows compatible .ico file from your image file. That can be done easily with the convert tool from Image Magick. Say you have an image file named myapp.png that is at least 256x256 in size:

convert myapp.png -background none -define icon:auto-resize=16,24,32,48,64,96,128,256 myapp.ico

Then add an ICON resource to the project in Visual Studio. Right click on the project > Add > Resource > Import > browse to myapp.ico

See favicon - Converting GIF's, PNG's and JPG's to .ICO files using Imagemagick - Stack Overflow

Taskbar icon


Hi @lb90,

Absolutely perfect, exactly what I wanted. Thank you so much!

I didn’t even think to do it through VS. Sometimes it takes someone to shine a light where you don’t know exists to open up a whole new perspective.