refactor! : drop subprocess usage and centralize brightness service initialization

This commit is contained in:
sankalp committed 2026-07-08 12:25:02 +05:45
1 parent 06be28535a
commit 5b8d6a62aa
21 files changed
+834 -828

No files matched your search

+12 -3
View File
@@ -74,6 +74,9 @@ class PerAppVolumeControl(Box):
audio_service.connect("stream-removed", self._on_stream_changed)
)
# Track last known app names to avoid unnecessary rebuilds
self._last_app_names = frozenset()
# Initial population
self._populate_apps()
@@ -84,9 +87,15 @@ class PerAppVolumeControl(Box):
"""Auto-refresh the application list every 2 seconds"""
if self._destroyed:
self._refresh_timer = None
return False # Remove GLib source
self._populate_apps()
return True # Continue the timer
return False
if not audio_service:
return True
apps = audio_service.applications or []
current_names = frozenset(a.name or "" for a in apps)
if current_names != self._last_app_names:
self._last_app_names = current_names
self._populate_apps()
return True
def _on_map(self, *_):
if self._refresh_timer is None: