feat(services): add fullscreenChanged signal and property handling

Add @Signal fullscreen_changed(), expose a read‑write fullscreen Property that triggers the signal on change, set its default to False, connect Hyprland’s fullscreen event to update the property, and store it on the service instance.
This commit is contained in:
sankalp committed 2026-07-08 13:21:42 +05:45
1 parent d1e1e68da5
commit 4dcfaed69e
1 file changed
+25
+25
View File
@@ -100,6 +100,9 @@ class ModusService(Service):
@Signal @Signal
def show_notificationcenter_changed(self, value: bool) -> None: ... def show_notificationcenter_changed(self, value: bool) -> None: ...
@Signal
def fullscreen_changed(self, value: bool) -> None: ...
@Signal @Signal
def notification_count_changed(self, value: int) -> None: ... def notification_count_changed(self, value: int) -> None: ...
@@ -167,6 +170,16 @@ class ModusService(Service):
def show_notificationcenter(self) -> bool: def show_notificationcenter(self) -> bool:
return self._show_notificationcenter return self._show_notificationcenter
@Property(bool, flags="read-write", default_value=False)
def fullscreen(self) -> bool:
return self._fullscreen
@fullscreen.setter
def fullscreen(self, value: bool):
if value != self._fullscreen:
self._fullscreen = value
self.fullscreen_changed(value)
@current_active_app_name.setter @current_active_app_name.setter
def current_active_app_name(self, value: str): def current_active_app_name(self, value: str):
if value != self._current_active_app_name: if value != self._current_active_app_name:
@@ -294,6 +307,7 @@ class ModusService(Service):
self._show_notificationcenter = False self._show_notificationcenter = False
self._dock_width = 0 self._dock_width = 0
self._dock_height = 0 self._dock_height = 0
self._fullscreen = False
@property @property
def notification_count(self) -> int: def notification_count(self) -> int:
@@ -327,6 +341,7 @@ def _setup_workspace_monitoring():
active_workspace = json.loads(workspace_data.decode("utf-8"))["name"] active_workspace = json.loads(workspace_data.decode("utf-8"))["name"]
service._current_workspace = str(active_workspace) service._current_workspace = str(active_workspace)
_hyprland_connection.connect("event::workspace", _on_workspace_changed) _hyprland_connection.connect("event::workspace", _on_workspace_changed)
_hyprland_connection.connect("event::fullscreen", _on_fullscreen_changed)
except Exception as e: except Exception as e:
logger.error(f"[ModusService] Failed to setup workspace monitoring: {e}") logger.error(f"[ModusService] Failed to setup workspace monitoring: {e}")
service._current_workspace = "1" service._current_workspace = "1"
@@ -378,6 +393,16 @@ def _on_workspace_changed(obj, signal):
logger.error(f"[ModusService] Error processing workspace change: {e}") logger.error(f"[ModusService] Error processing workspace change: {e}")
def _on_fullscreen_changed(obj, event):
service = get_modus_service()
try:
data = event.data[0] if event.data else ""
mode = data.split(":")[-1] if ":" in data else "0"
service.fullscreen = mode in ("1", "2")
except Exception as e:
logger.error(f"[ModusService] Error processing fullscreen change: {e}")
def remove_notification(id: int): def remove_notification(id: int):
get_notification_service().remove_cached_notification(id) get_notification_service().remove_cached_notification(id)
get_modus_service().notification_count_changed(get_notification_service().count) get_modus_service().notification_count_changed(get_notification_service().count)