From 20eef782ab4c12752fae84adaafed774f1d1481c Mon Sep 17 00:00:00 2001 From: Leonhard <106322251+leolost2605@users.noreply.github.com> Date: Mon, 23 Sep 2024 02:35:55 +0200 Subject: [PATCH] WindowIcon: reload icon if more info about the window becomes available (#2068) --- lib/WindowIcon.vala | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/WindowIcon.vala b/lib/WindowIcon.vala index 7c664726..b1e991c1 100644 --- a/lib/WindowIcon.vala +++ b/lib/WindowIcon.vala @@ -29,6 +29,19 @@ public class Gala.WindowIcon : Clutter.Actor { } construct { + /** + * Sometimes a WindowIcon is constructed on Meta.Display::window_created. + * In this case it can happen that we don't have any info about the app yet so we can't get the + * correct icon. Therefore we check whether the info becomes available at some point + * and if it does we try to get a new icon. + */ + window.notify["wm-class"].connect (reload_icon); + window.notify["gtk-application-id"].connect (reload_icon); + + reload_icon (); + } + + private void reload_icon () { width = icon_size * scale; height = icon_size * scale;