diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-09 20:31:56 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-09 20:31:56 +0100 |
| commit | 6b323fc06ec255153e86eafa4dffa67ad8c21f8c (patch) | |
| tree | bc361deaf28cf590f678f31f3fd4c31879688ef7 /deckit | |
| parent | f59efbd2df7b33ea8d8320b6cd29792986ea8023 (diff) | |
| download | deck-it-6b323fc06ec255153e86eafa4dffa67ad8c21f8c.tar.gz deck-it-6b323fc06ec255153e86eafa4dffa67ad8c21f8c.zip | |
feat: Windows tab shows all workspaces and icon-only launchers
Diffstat (limited to 'deckit')
| -rw-r--r-- | deckit/modules/windows.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/deckit/modules/windows.py b/deckit/modules/windows.py index d02fc0c..8642b1c 100644 --- a/deckit/modules/windows.py +++ b/deckit/modules/windows.py @@ -63,6 +63,12 @@ def make(cfg: dict) -> Module: run = cfg.get("run", _run) lua = hypr_lua(cfg) launch = cfg.get("launch", {}) + workspaces = cfg.get("windows", {}).get("workspaces", list(range(1, 11))) + + def launch_spec(spec): + if isinstance(spec, dict): + return spec.get("command"), spec.get("icon"), spec.get("label") + return spec, None, None def workspace(body): n = body.get("n") @@ -84,13 +90,19 @@ def make(cfg: dict) -> Module: def launch_key(body): key = str(body.get("key", "")) - command = launch.get(key) + command, _, _ = launch_spec(launch.get(key)) if command is None: raise ModuleError("unknown launch key") _popen(["sh", "-c", command] if isinstance(command, str) else command) def state(): - return {**_state(run), "launches": list(launch)} + st = _state(run) + known = sorted(set(int(n) for n in workspaces) | set(st["workspaces"])) + launches = [] + for key, spec in launch.items(): + _, icon, label = launch_spec(spec) + launches.append({"key": key, "icon": icon, "label": label or key}) + return {**st, "workspaces": known, "launches": launches} return Module(name="windows", title="Windows", state=state, actions={"workspace": workspace, "focus": focus, "close": close, "launch": launch_key}) |
