From ed64ddf8bfef4a974581eaa9c6c310ba66564b59 Mon Sep 17 00:00:00 2001 From: y1wtt Date: Mon, 6 Mar 2023 16:20:10 +0900 Subject: [PATCH 1/2] Fix icon loading order --- nwg_panel/modules/sni_system_tray/tray.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nwg_panel/modules/sni_system_tray/tray.py b/nwg_panel/modules/sni_system_tray/tray.py index c90041df..0d7d3f09 100644 --- a/nwg_panel/modules/sni_system_tray/tray.py +++ b/nwg_panel/modules/sni_system_tray/tray.py @@ -141,10 +141,10 @@ def add_item(self, item: StatusNotifierItem): event_box = Gtk.EventBox() image = Gtk.Image() - if "IconPixmap" in item.properties: - update_icon_from_pixmap(image, item, self.icon_size) - elif "IconName" in item.properties: + if "IconName" in item.properties: update_icon(image, item, self.icon_size, self.icons_path) + elif "IconPixmap" in item.properties: + update_icon_from_pixmap(image, item, self.icon_size) if "Tooltip" in item.properties: update_tooltip(image, item) @@ -177,11 +177,11 @@ def update_item(self, item: StatusNotifierItem, changed_properties: list[str]): event_box = self.items[full_service_name]["event_box"] image = self.items[full_service_name]["image"] - if "IconPixmap" in changed_properties: + if "IconThemePath" in changed_properties or "IconName" in changed_properties: + update_icon(image, item, self.icon_size, self.icons_path) + elif "IconPixmap" in changed_properties: update_icon_from_pixmap(image, item, self.icon_size) pass - elif "IconThemePath" in changed_properties or "IconName" in changed_properties: - update_icon(image, item, self.icon_size, self.icons_path) if "Tooltip" in changed_properties: update_tooltip(image, item) From 4d10e2c45e53dbd3e09551989a0ad4322af55261 Mon Sep 17 00:00:00 2001 From: y1wtt Date: Mon, 6 Mar 2023 16:20:28 +0900 Subject: [PATCH 2/2] Prevent loading of empty icon --- nwg_panel/modules/sni_system_tray/tray.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nwg_panel/modules/sni_system_tray/tray.py b/nwg_panel/modules/sni_system_tray/tray.py index 0d7d3f09..2661b41e 100644 --- a/nwg_panel/modules/sni_system_tray/tray.py +++ b/nwg_panel/modules/sni_system_tray/tray.py @@ -143,7 +143,7 @@ def add_item(self, item: StatusNotifierItem): if "IconName" in item.properties: update_icon(image, item, self.icon_size, self.icons_path) - elif "IconPixmap" in item.properties: + elif "IconPixmap" in item.properties and len(item.properties["IconPixmap"]) != 0: update_icon_from_pixmap(image, item, self.icon_size) if "Tooltip" in item.properties: @@ -179,7 +179,7 @@ def update_item(self, item: StatusNotifierItem, changed_properties: list[str]): if "IconThemePath" in changed_properties or "IconName" in changed_properties: update_icon(image, item, self.icon_size, self.icons_path) - elif "IconPixmap" in changed_properties: + elif "IconPixmap" in changed_properties and len(item.properties["IconPixmap"]) != 0: update_icon_from_pixmap(image, item, self.icon_size) pass