From 8f6042634f2721f9a3c5a5d6b0dee0c3cec04822 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 9 Apr 2026 18:33:40 +0545 Subject: [PATCH] feat(services): add current_active_wm_class tracking and signal, fix default active app name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New Features - Added `current_active_wm_class_changed` signal and `current_active_wm_class` read‑write property. - Implemented setter that emits the signal when the value changes. - Initialized `_current_active_wm_class` and integrated it into active window updates. - Enhancements - Extended active window handling to include window class information. - Bug Fixes - Corrected default active application name from "Hyprland" to "Finder". --- services/modus.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/modus.py b/services/modus.py index cb1b042..ce46768 100644 --- a/services/modus.py +++ b/services/modus.py @@ -31,6 +31,9 @@ class ModusService(Service): @Signal def current_active_app_name_changed(self, value: str) -> None: ... + @Signal + def current_active_wm_class_changed(self, value: str) -> None: ... + @Signal def current_workspace_changed(self, value: str) -> None: ... @@ -62,6 +65,10 @@ class ModusService(Service): def current_active_app_name(self) -> str: return self._current_active_app_name + @Property(str, flags="read-write") + def current_active_wm_class(self) -> str: + return self._current_active_wm_class + @Property(str, flags="read-write") def current_workspace(self) -> str: return self._current_workspace @@ -124,6 +131,12 @@ class ModusService(Service): self._current_active_app_name = value self.current_active_app_name_changed(value) + @current_active_wm_class.setter + def current_active_wm_class(self, value: str): + if value != self._current_active_wm_class: + self._current_active_wm_class = value + self.current_active_wm_class_changed(value) + @current_workspace.setter def current_workspace(self, value: str): if value != self._current_workspace: @@ -231,6 +244,7 @@ class ModusService(Service): self._dock_apps = "" self._dont_disturb = False self._current_active_app_name = "Finder" # Changed from "Hyprland" to "Finder" + self._current_active_wm_class = "" self._current_workspace = "1" self._music = "" self._current_dropdown = None @@ -311,6 +325,7 @@ class ModusService(Service): name = "Finder" self.current_active_app_name = name + self.current_active_wm_class = wmclass except Exception as e: logger.error(f"[ModusService] Error updating active window: {e}")