← Commit history

0.9.301: Taskbar hygiene (John: frozen progress bars on every KiCad window, no Adom badge): the boot sweep that clears leftover bars ran once at +6 s while ab was still restarting and failed silently; it now retries across the first two minutes until a window answers, and a five-minute idle reaper clears progress and badge on every KiCad window whenever the bridge is driving nothing. Filed adom/adom-bridge#138 for a progress TTL on ab's side.

John Lauer ·0d3d7f68e6 ·1mo ago ·parent 278afc1
1 file changed +38−7
handlers/win_taskbar.py+38−7
@@ -377,13 +377,44 @@ def badge_existing_on_boot() -> None:     # CLEAR them, off the boot path.     def _boot_clear():         import time as _t-        _t.sleep(6)-        try:-            for h in _enum_all_kicad_hwnds():-                _ad("desktop_taskbar", {"hwnd": int(h), "overlay": {"badge": "none"}})-                _paint_progress(h, None)     # a stale bar is the same lie-        except Exception:-            pass+        # John, 2026-09-03: twelve KiCad buttons kept frozen green bars for+        # hours after a night of bridge_install restarts. This sweep ran ONCE at+        # +6s, while ab itself was still restarting, and every call failed+        # silently. Retry across the first two minutes until at least one+        # window answers ok, then keep a slow idle reaper alive (below).+        for delay in (6, 15, 30, 60, 120):+            _t.sleep(delay)+            cleared = 0+            try:+                for h in _enum_all_kicad_hwnds():+                    r = _ad("desktop_taskbar", {"hwnd": int(h), "overlay": {"badge": "none"},+                                                "progress": {"state": "none"}})+                    if r:+                        cleared += 1+            except Exception:+                cleared = 0+            if cleared:+                print(f"[taskbar] boot sweep cleared {cleared} KiCad button(s)")+                break+        _idle_reaper()++    def _idle_reaper():+        """Fail-safe, the way ab reaps captions: every 5 minutes while the+        bridge is driving nothing, clear progress and badge on every KiCad+        window. A bar that nobody is painting is a lie, whoever painted it."""+        import time as _t+        while True:+            _t.sleep(300)+            try:+                with _inflight_lock:+                    busy = _inflight > 0+                if busy or (_last_drive and (_t.time() - _last_drive) < 60):+                    continue+                for h in _enum_all_kicad_hwnds():+                    _ad("desktop_taskbar", {"hwnd": int(h), "overlay": {"badge": "none"},+                                            "progress": {"state": "none"}})+            except Exception:+                pass     threading.Thread(target=_boot_clear, daemon=True,                      name="kicad-boot-badge-clear").start()