feat(src/window/panel): add persistent battery, network and bluetooth indicators with visibility handling and improve dropdown and config-driven layout logic

The refactor introduces persistent indicator widgets and updates how visibility and layout are managed based on configuration changes.

New Features
- Added BatteryIndicator, NetworkIndicator and BluetoothIndicator as persistent panel children.
- Implemented visibility toggling for each indicator according to configuration and battery presence.
- Added debug prints when an indicator’s visibility changes or a battery is not detected.

Enhancements
- Updated dropdown actions to use `get_about_window()` and `get_settings_window()` for About and System Settings entries.
- Switched layout rebuilding to use `get_config_all()` and now only rebuilds when specific keys actually change.
- Removed manual recreation of indicators; visibility is controlled via `show()`/`set_visible()`.
- Consolidated changed‑key detection and added logging of rebuild reasons.
- Streamlined config key checks to use `config_data.get(..., True)`.

Bug Fixes
- Fixed BatteryIndicator to hide and log when no battery is detected.
- Corrected use of `config_data.get()` with appropriate fallback values.
- Updated layout updates to use `show()` and trigger a resize queue instead of `show_all()`.
This commit is contained in:
sankalp committed 2026-05-03 22:06:42 +05:45
1 parent 704c8b229c
commit be308191c5
3 files changed
+76 -39

No files matched your search

+4 -4
View File
@@ -5,12 +5,13 @@ from fabric.widgets.button import Button
from fabric.widgets.centerbox import CenterBox
from fabric.widgets.label import Label
from shared.dialogs.about import About, AboutApp
from shared.dialogs.about import AboutApp, get_about_window
from shared.window.dropdown import ModusDropdown, dropdown_divider, dropdowns
from shared.window.mousecapture import DropDownMouseCapture
from utils.app_name_resolver import format_window
from utils.roam import modus_service
from utils.utils import setup_cursor_hover
from window.settings.main import get_settings_window
def has_active_window():
@@ -111,13 +112,12 @@ class SystemDropdown(ModusDropdown):
parent=parent,
dropdown_children=[
dropdown_option(
"About this PC", on_clicked=lambda _: About().toggle(_)
"About this PC", on_clicked=lambda _: get_about_window().toggle()
),
dropdown_divider("---------------------"),
dropdown_option(
"System Settings...",
# TODO: Open Modus own setting
# on_click="xdg-open settings",
on_clicked=lambda _: get_settings_window().toggle(),
),
dropdown_divider("---------------------"),
dropdown_option("Force Quit", "", "hyprctl kill"),
@@ -432,6 +432,7 @@ class BatteryIndicator(Box):
def update_state(self):
if not self._is_present():
print("[Battery] No battery detected, hiding indicator")
self.set_visible(False)
return
else: