refactor(src/window/controlcenter): simplify MPRIS handling and add aggressive cache cleanupRemoved unused imports, merged player manager, and immediately clean cache to prevent leaks

This commit is contained in:
sankalp committed 2026-06-17 03:18:24 +05:45
1 parent fa2c157663
commit 1def82aeb9
3 files changed
+657 -1977

No files matched your search

File diff suppressed because it is too large. Load diff
+19 -6
View File
@@ -616,14 +616,24 @@ class ModusControlCenter(AppletWindow):
self.has_per_app_volume_open = False
self.has_expanded_player_open = False
# Reset current view
self.current_view = "main"
# Instantly reset the view
self._delayed_reset_view()
logger.debug("Control center signals disconnected while hidden")
except Exception as e:
logger.warning(f"Control center signal disconnection failed: {e}")
def _delayed_reset_view(self):
if not self.get_visible():
self.has_bluetooth_open = False
self.has_wifi_open = False
self.has_per_app_volume_open = False
self.has_expanded_player_open = False
self.current_view = "main"
self.set_children(self.center_box)
return False
def _ensure_bluetooth_widgets(self):
"""Lazy load bluetooth widgets"""
if self.bluetooth_widgets is None:
@@ -949,10 +959,13 @@ class ModusControlCenter(AppletWindow):
self.set_visible(visible)
if not visible:
self.close_bluetooth()
self.close_wifi()
self.close_per_app_volume()
self.close_expanded_player()
# Simply reset views without multiple overlapping set_children calls
self.has_bluetooth_open = False
self.has_wifi_open = False
self.has_per_app_volume_open = False
self.has_expanded_player_open = False
self.current_view = "main"
self.set_children(self.center_box)
def volume_changed(
self,
File diff suppressed because it is too large. Load diff