← Commit history

0.9.340: land the shipped runtime source for handlers/kicad_windows.py (tour fixes 0.9.318-0.9.339 never reached master, issue #79)

John Lauer ·d65e4be3f4 ·1mo ago ·parent 6745e30
1 file changed +10−1
handlers/kicad_windows.py+10−1
@@ -53,7 +53,11 @@ def _from_ad() -> list | None:         r = ad_client.call("desktop_list_windows", {}, timeout=6) or {}     except Exception:  # pylint: disable=broad-except         return None-    out = r.get("output") if isinstance(r, dict) else None+    # The direct API hands the verb payload back UNWRAPPED (top-level+    # `windows`; measured on arav-rog 2026-09-05, where this returned None and+    # the tour fell back to a local list with no z-order, so no beat could+    # verify or foreground). Older shapes wrap it in output / data. Accept all.+    out = r.get("output") if isinstance(r, dict) and "output" in r else r     if isinstance(out, str):         try:             import json as _j@@ -62,6 +66,8 @@ def _from_ad() -> list | None:             return None     data = (out or {}).get("data") if isinstance(out, dict) else None     wins = (data or {}).get("windows") if isinstance(data, dict) else None+    if not isinstance(wins, list) and isinstance(out, dict):+        wins = out.get("windows")     if not isinstance(wins, list):         return None     rows = []@@ -78,6 +84,9 @@ def _from_ad() -> list | None:                      "width": rect.get("width", 0), "height": rect.get("height", 0)},             "z": w.get("z"),             "kind": w.get("kind"),+            # carried through so 'in front' can skip minimized windows and shell popups+            "minimized": bool(w.get("minimized")), "maximized": bool(w.get("maximized")),+            "image": w.get("image") or "", "pid": w.get("pid"),         })     return rows