A common problem in Wayland session is some apps show generic Wayland icon instead of the proper application icon. Here is an example:

Fortunately, this problem is very easy to fix for common GUI libraries.

Here are the solutions (replace APP_ID with application ID):

Qt

C++

#include <QGuiApplication>

QGuiApplication::setDesktopFileName(APP_ID);

or

#include <QApplication>

QApplication app(argc, argv);
app.setDesktopFileName(APP_ID);

PyQt (Python)

from PyQt6.QtGui import QGuiApplication

QGuiApplication.setDesktopFileName(APP_ID)

or

class Application(QtWidgets.QApplication):
...


app = Application()
app.setDesktopFileName(APP_ID)

GTK

C

g_set_prgname(APP_ID);

gtkmm (C++)

Glib::set_prgname(APP_ID);

gtk-rs (Rust)

glib::set_prgname(Some(APP_ID));

PyGObject (Python)

from gi.repository import GLib

GLib.set_prgname(APP_ID)

GLFW

glfwWindowHintString(GLFW_WAYLAND_APP_ID, APP_ID);

Slint

use i_slint_backend_winit::winit::platform::wayland::WindowAttributesExtWayland;

let backend = i_slint_backend_winit::Backend::builder()
    .with_window_attributes_hook(|attr| attr.with_name(APP_ID, ""))
    .build()
    .unwrap();

slint::platform::set_platform(Box::new(backend))