diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:49 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:49 +0100 |
| commit | 4bc6d69fc0fbfc3de5fb84874985a26deb79fdb5 (patch) | |
| tree | e5209733fb7b1b8a5d31ad53e703b04273bb1c4c /deckit/modules/windows.py | |
| parent | 863f7453f9e136cadc93db9f3f0b8f257f798ce8 (diff) | |
| download | deck-it-4bc6d69fc0fbfc3de5fb84874985a26deb79fdb5.tar.gz deck-it-4bc6d69fc0fbfc3de5fb84874985a26deb79fdb5.zip | |
fix(windows): no peek for a dialog
A transient dialog brought the Windows tab forward like any new window.
Hyprland's clients JSON has no parent field, so a window counts as a
dialog when it floats and its pid already has another window; peek()
skips those. They are still listed in the grid.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'deckit/modules/windows.py')
| -rw-r--r-- | deckit/modules/windows.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/deckit/modules/windows.py b/deckit/modules/windows.py index 343daad..7df1f8e 100644 --- a/deckit/modules/windows.py +++ b/deckit/modules/windows.py @@ -140,10 +140,15 @@ def _state(run): workspaces = json.loads(run(["hyprctl", "workspaces", "-j"]) or "[]") except json.JSONDecodeError: return {"windows": [], "workspaces": [], "activeClass": None} + clients = [c for c in clients if c.get("mapped", True) and c["workspace"].get("id", 0) > 0] + # ponytail: Hyprland exposes no transient parent, so a dialog is a + # floating window whose process already has another window open. + pids = [c.get("pid") for c in clients] wins = sorted( ({"address": c["address"], "id": c.get("stableId", ""), "class": c["class"], "title": c["title"], - "workspace": c["workspace"]["id"], "active": c["address"] == active} - for c in clients if c.get("mapped", True) and c["workspace"].get("id", 0) > 0), + "workspace": c["workspace"]["id"], "active": c["address"] == active, + "dialog": bool(c.get("floating")) and pids.count(c.get("pid")) > 1} + for c in clients), key=lambda w: (w["workspace"], w["class"])) active_class = next((w["class"] for w in wins if w["active"]), None) return {"windows": wins, |
