aboutsummaryrefslogtreecommitdiffstats
path: root/deckit/modules/windows.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-09 18:25:59 +0100
committerDanilo M. <danix@danix.xyz>2026-11-09 18:25:59 +0100
commit7f99167f0b6a3c83bf77e20bc5e03942b901fb71 (patch)
tree6b60263b6f702e6088eae30087c6dfa2a5a71f4c /deckit/modules/windows.py
parent03e2adab3fb58532ba1e32c2f01a9ec14f11e484 (diff)
downloaddeck-it-7f99167f0b6a3c83bf77e20bc5e03942b901fb71.tar.gz
deck-it-7f99167f0b6a3c83bf77e20bc5e03942b901fb71.zip
fix: OBS idle timeout, payload validation, workspace list
Diffstat (limited to 'deckit/modules/windows.py')
-rw-r--r--deckit/modules/windows.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/deckit/modules/windows.py b/deckit/modules/windows.py
index 022bdd7..d02fc0c 100644
--- a/deckit/modules/windows.py
+++ b/deckit/modules/windows.py
@@ -45,7 +45,7 @@ def _state(run):
try:
clients = json.loads(run(["hyprctl", "clients", "-j"]) or "[]")
active = json.loads(run(["hyprctl", "activewindow", "-j"]) or "{}").get("address")
- monitors = json.loads(run(["hyprctl", "monitors", "-j"]) or "[]")
+ workspaces = json.loads(run(["hyprctl", "workspaces", "-j"]) or "[]")
except json.JSONDecodeError:
return {"windows": [], "workspaces": [], "activeClass": None}
wins = sorted(
@@ -54,7 +54,8 @@ def _state(run):
for c in clients if c.get("mapped", True) and c["workspace"]["id"] > 0),
key=lambda w: (w["workspace"], w["class"]))
active_class = next((w["class"] for w in wins if w["active"]), None)
- return {"windows": wins, "workspaces": [m["activeWorkspace"]["id"] for m in monitors],
+ return {"windows": wins,
+ "workspaces": sorted(w["id"] for w in workspaces if w.get("id", 0) > 0),
"activeClass": active_class}
@@ -88,5 +89,8 @@ def make(cfg: dict) -> Module:
raise ModuleError("unknown launch key")
_popen(["sh", "-c", command] if isinstance(command, str) else command)
- return Module(name="windows", title="Windows", state=lambda: _state(run),
+ def state():
+ return {**_state(run), "launches": list(launch)}
+
+ return Module(name="windows", title="Windows", state=state,
actions={"workspace": workspace, "focus": focus, "close": close, "launch": launch_key})