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)?
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.
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?
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.
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: