From 703a9b3d3afdfc5652a07f138168416a06e3271e Mon Sep 17 00:00:00 2001 From: Steef Hegeman Date: Sat, 18 Dec 2021 13:44:17 +0100 Subject: [PATCH] AppInd. "convention": accept paths for IconName It is not intended for apps to set paths as icon name. Some do it anyway, and some hosts accept it. snixembed now does so too. --- src/proxyicon.vala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/proxyicon.vala b/src/proxyicon.vala index e97ac2c..aa1fabe 100644 --- a/src/proxyicon.vala +++ b/src/proxyicon.vala @@ -47,6 +47,14 @@ class ProxyIcon : Object { void set_icon() { var name = item.icon_name; if (name != null && name != "") { + /* Some apps wrongly set a filename for name, relying on this + * undefined behavior. Since StatusIcon.set_from_file gives no + * feedback, this check and race is about the best we can do. */ + if (name.contains("/") && FileUtils.test(name, FileTest.EXISTS)) { + icon.set_from_file(name); + return; + } + var theme = Gtk.IconTheme.get_for_screen(icon.screen); var path = item.icon_theme_path; if (path != null) { -- 2.45.2