Search code examples
c++gtkmm3

Gtk::Window icon set with set_icon_name doesn't work on wayland


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


Solution

  • 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