1

I'm trying to solve a synfig issue by testing out this sample program:

#include <gtkmm.h>
#include <iostream>

class HelloWindow : public Gtk::Window {
        public:
                HelloWindow();
                ~HelloWindow();
};

HelloWindow::HelloWindow()
{
        set_icon_name("org.synfig.SynfigStudio"); // <- name copied from synfig build

        property_title() = "Hello Window";
        property_default_width() = 320;
        property_default_height() = 240;

        present();
}

HelloWindow::~HelloWindow()
{
}

int main()
{
        Glib::RefPtr<Gtk::Application> app = Gtk::Application::create("org.gtkmm.Hello");

        HelloWindow hello;

        return app->run(hello);
}

I copied synfig hicolor icons to my ~/.icons/ directory.

On running the sample program, the icon is displayed on X11 GNOME session

Whereas, on Wayland, I get executable icons as replacement

Also, tried with pre-installed system icons, like "org.gnome.Calculator"

The window icon works on X11 but not on Wayland

1 Answers1

1

The answer is not mine. A user from GTK irc gave this and I'm only quoting the conversation

Here is the chat history: Riot | GTK

And the quoted answer

normally you have a desktop file

and the icon (and the name) are used from there

so if synfig studio doens't have one, well, add one

  • 1
    That is indeed correct for Linux. But what about windows? I cross compiled my gtk app to Windows. But how to get an icon under Windows? – Melroy van den Berg Jan 21 '22 at 01:54
  • For Windows, I remember packaging *.ico files to my gtk app using a 3rd party tool. Works. Sadly I don't remember that tool's name :( – Keyikedalube Ndang Jan 24 '22 at 06:54
  • I found the tool's name: [rcedit](https://github.com/electron/rcedit). And just for quick review of how to export png icon file to *.ico files [Changing application icon for Windows](https://docs.godotengine.org/en/stable/getting_started/workflow/export/changing_application_icon_for_windows.html) – Keyikedalube Ndang Jan 24 '22 at 07:06
  • Well this is for Godot. Not when you are using c++ I think. Anyway, yes you need an ico file but you also need a windows resource file. I just found out what such file needs to be compiled with windres compiler (rc file compiler). – Melroy van den Berg Jan 25 '22 at 12:32