From ad6d35fe461705a0722598df411c3afcacea2215 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 10 Apr 2026 01:13:29 +0545 Subject: [PATCH] feat(modules/panel/components): adjust dropdown capture layer and pointer widget assignments Changed the default layer used by `create_dropdown_with_capture` from `"bottom"` to `"top"` and updated the call site accordingly. Added safety checks to set `_pointing_widget` on indicator windows when they exist, preventing potential errors when the windows are not created. - Enhancements: - Updated default `layer` parameter in `create_dropdown_with_capture` to `"top"`. - Bug Fixes: - Ensured `BluetoothIndicator`, `NetworkIndicator`, and `BatteryIndicator` properly assign `_pointing_widget` to their respective buttons when the associated windows are present. --- modules/panel/components/globalmenu.py | 6 ++---- modules/panel/components/indicators.py | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/panel/components/globalmenu.py b/modules/panel/components/globalmenu.py index 6dc03aa..d124b5b 100644 --- a/modules/panel/components/globalmenu.py +++ b/modules/panel/components/globalmenu.py @@ -34,9 +34,7 @@ def create_menu_button(label, on_clicked=None): return button -def create_dropdown_with_capture( - dropdown_id, parent, dropdown_children, layer="bottom" -): +def create_dropdown_with_capture(dropdown_id, parent, dropdown_children, layer="top"): dropdown = ModusDropdown( dropdown_id=dropdown_id, parent=parent, @@ -140,7 +138,7 @@ class GlobalMenuDropdowns: self.system_dropdown = SystemDropdown(parent=parent) self.menu_button_dropdown = DropDownMouseCapture( - layer="bottom", child_window=self.system_dropdown + layer="top", child_window=self.system_dropdown ) self.menu_button = Button( label="Modus", diff --git a/modules/panel/components/indicators.py b/modules/panel/components/indicators.py index d22d393..c8aa407 100644 --- a/modules/panel/components/indicators.py +++ b/modules/panel/components/indicators.py @@ -85,6 +85,8 @@ class BluetoothIndicator(Box): self, show_back_button=False, ) + if self.bluetooth_window: + self.bluetooth_window._pointing_widget = self.bt_button modus_service.connect("bluetooth-changed", self.on_bluetooth_changed) self.bluetooth.connect("changed", self.on_bluetooth_direct_changed) @@ -194,6 +196,8 @@ class NetworkIndicator(Box): self, show_back_button=False, ) + if self.wifi_window: + self.wifi_window._pointing_widget = self.network_button modus_service.connect("wlan-changed", self.on_wlan_changed) self.network_service.connect("wifi-device-added", self.on_wifi_device_added) @@ -348,6 +352,8 @@ class BatteryIndicator(Box): self, show_back_button=False, ) + if self.battery_window: + self.battery_window._pointing_widget = self.battery_button modus_service.connect("battery-changed", self.on_battery_changed) self.battery_service.connect("changed", self.on_battery_direct_changed)