allow graphically deleting applets

by roundabout, Friday, 12 December 2025, 21:30:44 (1765575044), pushed by roundabout, Friday, 12 December 2025, 21:30:47 (1765575047)

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

a2502f2de54671754a5db20280d1766b510f67bc

config.yaml

@@ -64,49 +64,6 @@ panels:

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                - NotifierApplet:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    icon_size: 24
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    empty_icon_size: 16
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            - AppMenu:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                category_mappings:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Utility:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Accessories
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-accessories
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Development:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Programming
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-development
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Game:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Games
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-games
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Graphics:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Graphics
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-graphics
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Network:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Network
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-internet
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  AudioVideo:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Multimedia
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-multimedia
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Office:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Office
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-office
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Science:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Science
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-science
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Education:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Education
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-education
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  System:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: System
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-system
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Settings:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Settings
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: preferences-desktop
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  Other:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    menu_name: Other
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    icon: applications-other
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                trigger_name: app-menu
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                icon_name: start-here-symbolic
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                icon_size: 24
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            - ClockApplet:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                formatting: '%c'
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                right:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                - BatteryMonitor:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    icon_size: 24
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                            
                                

main.py

@@ -319,6 +319,25 @@ class AppletListing(Gtk.Window):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        applet_widget = AppletChoice(applet)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.flowbox.append(applet_widget)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.drop_target = Gtk.DropTarget.new(GObject.TYPE_UINT64, Gdk.DragAction.MOVE)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.drop_target.set_gtypes([GObject.TYPE_UINT64])
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.drop_target.connect("drop", self.drop_applet)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.add_controller(self.drop_target)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            def drop_applet(self, drop_target: Gtk.DropTarget, value: int, x: float, y: float):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                # Applet deletion
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                applet = self.get_root().get_application().drags[value]
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                old_area: AppletArea = applet.get_parent()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                if old_area:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    old_area.remove(applet)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                del applet
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.get_root().get_application().drags.pop(value)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.get_root().get_application().save_config()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                return True
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            def get_applet_directories():
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                data_home = Path(os.getenv("XDG_DATA_HOME", Path.home() / ".local" / "share"))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -343,7 +362,6 @@ class AppletArea(Gtk.Box):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    self.drop_target.connect("drop", self.drop_applet)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                def drop_applet(self, drop_target: Gtk.DropTarget, value: int, x: float, y: float):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                print(value)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    obj = self.get_root().get_application().drags[value]
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    if isinstance(obj, type):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        applet = obj()