Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

Fix icon loading

by roundabout, Sunday, 27 July 2025, 15:21:09 (1753629669), pushed by soreau, Saturday, 9 August 2025, 12:22:37 (1754742157)

Author identity: vlad <vlad.muntoiu@gmail.com>

7bc3459d6824e89be9101572b09521709f4a67bf

applets/wf-window-list/__init__.py

@@ -83,21 +83,23 @@ class WindowButton(Gtk.ToggleButton):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                def set_icon_from_app_id(self, app_id):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # Try getting an icon from the correct theme
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    app_ids = app_id.split()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                icon_theme = Gtk.IconTheme()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                icon_theme = Gtk.IconTheme.get_for_display(self.get_display())
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    for app_id in app_ids:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.get_parent().print_log(app_id)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        if icon_theme.has_icon(app_id):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            self.icon.set_from_icon_name(app_id)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            return
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # If that doesn't work, try getting one from .desktop files
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    for app_id in app_ids:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    desktop_file = Gio.DesktopAppInfo.new(app_id + ".desktop")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    if desktop_file:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        self.icon.set_from_gicon(desktop_file.get_icon())
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        return
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    try:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        desktop_file = Gio.DesktopAppInfo.new(app_id + ".desktop")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        if desktop_file:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                            self.icon.set_from_gicon(desktop_file.get_icon())
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                            return
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    except TypeError:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        # Due to a bug, the constructor may sometimes return C NULL
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        pass
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            class WFWindowList(panorama_panel.Applet):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -146,7 +148,7 @@ class WFWindowList(panorama_panel.Applet):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                def on_global(self, registry, name, interface, version):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    if interface == "zwlr_foreign_toplevel_manager_v1":
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.print_log("WFWindowList: Interface registered")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.print_log("Interface registered")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.manager = registry.bind(name, ZwlrForeignToplevelManagerV1, version)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.manager.dispatcher["toplevel"] = self.on_new_toplevel
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.manager.dispatcher["finished"] = lambda *a: print("Toplevel manager finished")