feat(services): add current_active_wm_class tracking and signal, fix default active app name

- 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".
This commit is contained in:
sankalp committed 2026-04-09 18:33:40 +05:45
1 parent d47537e627
commit 8f6042634f
1 file changed
+15
+15
View File
@@ -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}")