From afbffc4fa6d6731b9aa5302ba6de9ce38e896b0c Mon Sep 17 00:00:00 2001 From: stephen finkel Date: Wed, 4 Nov 2026 02:18:47 -0500 Subject: [PATCH] icons: fall back to StartupWMClass when resolving application icons Some applications report a window class that differs from their desktop file ID, leaving their window-list icons blank. For example, HexChat reports "Hexchat" but installs io.github.Hexchat.desktop. When desktop file ID lookup fails, search installed desktop entries for a matching StartupWMClass and use the entry's icon. Signed-off-by: stephen finkel Assisted-by: ChatGPT:GPT-5.6 Sol --- src/util/gtk-utils.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/util/gtk-utils.cpp b/src/util/gtk-utils.cpp index 88a60c8d0..74e913e69 100644 --- a/src/util/gtk-utils.cpp +++ b/src/util/gtk-utils.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "wf-shell-app.hpp" Glib::RefPtr load_icon_pixbuf_safe(std::string icon_path, int size) @@ -115,6 +116,28 @@ Glib::RefPtr get_from_desktop_app_info(std::string app_id) } } + /* The window class may differ from the desktop file ID. */ + for (const auto& info : Gio::AppInfo::get_all()) + { + auto desktop = + std::dynamic_pointer_cast(info); + + if (!desktop) + { + continue; + } + + const auto wm_class = desktop->get_startup_wm_class(); + if (!wm_class.empty() && (wm_class == app_id)) + { + auto icon = desktop->get_icon(); + if (icon) + { + return icon; + } + } + } + return {}; }