By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

Configurable window list button width

roundabout,
created on Sunday, 3 August 2025, 20:10:14 (1754251814), received on Sunday, 3 August 2025, 20:10:17 (1754251817)
Author identity: Vlad <vlad.muntoiu@gmail.com>

9d6965ddcd04c99ab0c11a17b156b87ad99a9264

applets/wf-window-list/__init__.py

@@ -50,6 +50,17 @@ gtk = ffi.dlopen("libgtk-4.so.1")

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            module_directory = Path(__file__).resolve().parent
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        @Gtk.Template(filename=str(module_directory / "panorama-window-list-options.ui"))
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        class WindowListOptions(Gtk.Window):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            __gtype_name__ = "WindowListOptions"
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            button_width_adjustment: Gtk.Adjustment = Gtk.Template.Child()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            def __init__(self, **kwargs):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                super().__init__(**kwargs)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.connect("close-request", lambda *args: self.destroy())
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            def split_bytes_into_ints(array: bytes, size: int = 4) -> list[int]:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                if len(array) % size:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    raise ValueError(f"The byte string's length must be a multiple of {size}")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -356,7 +367,25 @@ class WFWindowList(panorama_panel.Applet):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    self.context_menu.popup()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                def show_options(self, _0=None, _1=None):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                pass
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                if self.options_window is None:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.options_window = WindowListOptions()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.options_window.button_width_adjustment.set_value(self.window_button_options.max_width)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.options_window.button_width_adjustment.connect("value-changed", self.update_button_options)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    def reset_window(*args):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        self.options_window = None
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.options_window.connect("close-request", reset_window)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.options_window.present()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            def update_button_options(self, adjustment):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                self.window_button_options.max_width = adjustment.get_value()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                child: Gtk.Widget = self.get_first_child()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                while child:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    child.queue_allocate()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    child.queue_resize()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    child.queue_draw()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    child = child.get_next_sibling()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                def get_config(self):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    return {}
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                            
                                

applets/wf-window-list/panorama-window-list-options.ui

@@ -0,0 +1,93 @@

                                
                                
                                
                            
                                
                                    
                                        
                                        <?xml version='1.0' encoding='UTF-8'?>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        <!-- Created with Cambalache 0.96.1 -->
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        <interface>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                          <!-- interface-name panorama-clock-options.ui -->
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                          <!-- interface-description Provides a window with configuration options for the clock. -->
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                          <!-- interface-copyright Copyright 2025, roundabout-host.com <vlad@roundabout-host.com>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        This program is free software: you can redistribute it and/or modify
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        it under the terms of the GNU General Public Licence as published by
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        the Free Software Foundation, either version 3 of the Licence, or
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        (at your option) any later version.
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        This program is distributed in the hope that it will be useful,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        but WITHOUT ANY WARRANTY; without even the implied warranty of
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        GNU General Public Licence for more details.
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        You should have received a copy of the GNU General Public Licence
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        along with this program. If not, see <https://www.gnu.org/licenses/>. -->
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                          <requires lib="gtk" version="4.0"/>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                          <template class="WindowListOptions" parent="GtkWindow">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            <property name="default-height">320</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            <property name="default-width">576</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            <property name="title" translatable="yes">Window list options</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                              <object class="GtkScrolledWindow">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  <object class="GtkViewport">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                      <object class="GtkBox">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        <property name="margin-bottom">32</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        <property name="margin-end">32</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        <property name="margin-start">32</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        <property name="margin-top">32</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        <property name="orientation">vertical</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        <property name="spacing">4</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                          <object class="GtkFrame">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                            <property name="label-widget">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                              <object class="GtkLabel">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                <property name="label" translatable="yes">Layout</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                <attributes>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                  <attribute name="weight" value="bold"/>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                </attributes>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                              </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                            </property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                            <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                              <object class="GtkListBox">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                <property name="selection-mode">none</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                  <object class="GtkListBoxRow">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                    <property name="activatable">False</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                    <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                      <object class="GtkBox">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                        <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                          <object class="GtkLabel">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            <property name="halign">start</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            <property name="hexpand">True</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            <property name="label" translatable="yes">Maximum width of window buttons</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            <property name="use-markup">True</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            <property name="wrap">True</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                          </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                        </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                        <child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                          <object class="GtkSpinButton">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            <property name="adjustment">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                              <object class="GtkAdjustment" id="button_width_adjustment">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                                <property name="lower">24.0</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                                <property name="page-increment">1.0</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                                <property name="page-size">1.0</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                                <property name="step-increment">1.0</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                                <property name="upper">16384.0</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                              </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            </property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                            <property name="numeric">True</property>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                          </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                        </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                      </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                    </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                  </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                              </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                            </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                          </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                      </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                  </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                              </object>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            </child>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                          </template>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        </interface>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                            
                                

applets/wf-window-list/panorama-window-list.cmb

@@ -0,0 +1,6 @@

                                
                                
                                
                            
                                
                                    
                                        
                                        <?xml version='1.0' encoding='UTF-8' standalone='no'?>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        <!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        <!-- Created with Cambalache 0.96.1 -->
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        <cambalache-project version="0.96.0" target_tk="gtk-4.0">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                          <ui template-class="WindowListOptions" filename="panorama-window-list-options.ui" sha256="190e4759fc5ad869f104b70803cdefc1e59e1f5b1ebb3c2c60be6b5d3a203a6a"/>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        </cambalache-project>