From a344c1599edb64ffc4ad2b59de88616c6509bce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 19 Mar 2024 13:16:50 +0100 Subject: [PATCH 1/2] window-list: Use more appropriate fallback icon 'icon-missing' is not an actual icon name. It somewhat works because an invalid icon name will fallback to the correct 'image-missing', however for apps the generic app icon is a better fallback. Part-of: --- extensions/window-list/extension.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 90bf34cd..c3ffe92f 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -165,7 +165,7 @@ class WindowTitle extends St.BoxLayout { this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE); } else { this._icon.child = new St.Icon({ - icon_name: 'icon-missing', + icon_name: 'application-x-executable', icon_size: ICON_TEXTURE_SIZE, }); } -- 2.44.0 From c0cccebbdf543d25851872abdfdf119a5a9657aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 19 Mar 2024 14:07:12 +0100 Subject: [PATCH 2/2] window-list: Override with window icon if available --- extensions/window-list/extension.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index c3ffe92f..034b72ba 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -169,6 +169,23 @@ class WindowTitle extends St.BoxLayout { icon_size: ICON_TEXTURE_SIZE, }); } + + // Override with window icon if available + if (this._hasWindowIcon()) { + const textureCache = St.TextureCache.get_default(); + this._icon.child.gicon = textureCache.bind_cairo_surface_property( + this._metaWindow, 'icon'); + } + } + + _hasWindowIcon() { + // HACK: GI cannot handle CairoSurface, so this + // will throw if the icon property is null + try { + return this._metaWindow.icon !== null; + } catch (e) { + return true; + } } } -- 2.44.0