Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(overlay): keep the mascot and bar out of captures from their first show
rubenluetke10-beepcb8856797584
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 01b4e8353b..47620d655f 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -15590,3 +15590,23 @@ swept at once with an `error_detail` naming the exited process. An alive orunknown owner keeps the old freshness guard, so a second instance still neversweeps a mission a live first instance is running. The restart that killedthe worker is outside this fix. Guard: `tests/missions/test_recovery_owner.py`.++## BUG-230: the mascot and the bar showed up inside appshots and screenshots (MEDIUM, FIXED 2026-10-02)++**Symptom.** An appshot of the Personal Jarvis window, and a full-screen+capture, both contained the floating mascot on top of the content, although+the overlays are meant to stay out of every capture.++**Cause.** The overlays call `exclude_tk_window_from_capture` before their+first show. Tk creates a toplevel's outer window only when it is first mapped,+so `GetParent(winfo_id())` was 0, the display affinity landed on the inner+child window, and the real outer window kept affinity 0 (measured on the live+`JarvisOrb`: `GetWindowDisplayAffinity` = 0x0).++**Fix.** `jarvis/platform/capture_exclusion.py` no longer targets the inner+child and additionally re-applies `WDA_EXCLUDEFROMCAPTURE` on every `<Map>` of+the toplevel (bound with `add="+"`, child-widget maps ignored). Checked with a+real Tk root and Toplevel: 0x11 after the first map and after withdraw/show.+Side effect: the overlays also vanish from other capture tools (ShareX, OBS),+which is the documented intent of the module. Guard:+`tests/unit/platform/test_capture_exclusion.py`.diff --git a/jarvis/platform/capture_exclusion.py b/jarvis/platform/capture_exclusion.pyindex 28cbc1feae..8c3fe5dc42 100644--- a/jarvis/platform/capture_exclusion.py+++ b/jarvis/platform/capture_exclusion.py@@ -66,8 +66,15 @@ def exclude_tk_window_from_capture(root: Any) -> bool:"""Exclude a Tk toplevel. Targets the outer ``TkTopLevel`` HWND on Windows.Tk's ``winfo_id()`` is the inner ``TkChild``; capture affinity has to- land on the parent or the overlay still photographs. Best-effort: a- missing handle or a test double without ``winfo_id`` returns False.+ land on the parent or the overlay still photographs. Tk creates that+ parent only when the toplevel is first mapped, and the overlays call this+ before their first show — so the exclusion is also re-applied on every+ ``<Map>`` of the toplevel (a re-created wrapper starts without it). Before+ that fix the mascot sat in every appshot of the window under it.++ Returns True when the outer window is excluded now or will be on its first+ map. Best-effort: a missing handle or a test double without ``winfo_id``+ returns False."""if root is None:return False@@ -75,6 +82,11 @@ def exclude_tk_window_from_capture(root: Any) -> bool:return exclude_macos_app_windows()if sys.platform != "win32":return False+ scheduled = _reapply_on_map(root)+ return _exclude_outer_tk_window(root) or scheduled+++def _exclude_outer_tk_window(root: Any) -> bool:try:inner = int(root.winfo_id())except Exception: # noqa: BLE001 — FakeRoot / torn-down interpreter@@ -83,12 +95,41 @@ def exclude_tk_window_from_capture(root: Any) -> bool:if user32 is None or not inner:return Falsetry:- outer = int(user32.GetParent(inner) or inner)+ outer = int(user32.GetParent(inner) or 0)except Exception: # noqa: BLE001- outer = inner+ outer = 0+ if not outer:+ # Not mapped yet: there is no outer window to exclude. The inner child+ # cannot carry a display affinity, so the <Map> hook does the work.+ return Falsereturn exclude_hwnd_from_capture(outer)+_MAP_HOOK_ATTR = "_jarvis_capture_exclusion_on_map"+++def _reapply_on_map(root: Any) -> bool:+ """Bind one ``<Map>`` hook that re-excludes the toplevel's outer window."""+ if getattr(root, _MAP_HOOK_ATTR, False):+ return True+ bind = getattr(root, "bind", None)+ if not callable(bind):+ return False++ def _on_map(event: Any) -> None:+ # The toplevel's bind tag also fires for every child widget's map.+ if getattr(event, "widget", root) is root:+ _exclude_outer_tk_window(root)++ try:+ bind("<Map>", _on_map, "+")+ setattr(root, _MAP_HOOK_ATTR, True)+ except Exception: # noqa: BLE001 — overlay must degrade, never crash+ log.debug("capture exclusion: could not hook <Map>", exc_info=True)+ return False+ return True++def exclude_macos_app_windows() -> bool:"""Mark every NSWindow of this process as not shareable (overlay hosts).diff --git a/tests/unit/platform/test_capture_exclusion.py b/tests/unit/platform/test_capture_exclusion.pyindex e1364127d4..bf84cd45e3 100644--- a/tests/unit/platform/test_capture_exclusion.py+++ b/tests/unit/platform/test_capture_exclusion.py@@ -46,3 +46,57 @@ def test_exclude_tk_window_targets_the_outer_toplevel(monkeypatch) -> None:def test_exclude_tk_window_survives_a_root_without_winfo_id() -> None:assert exclusion.exclude_tk_window_from_capture(object()) is Falseassert exclusion.exclude_tk_window_from_capture(None) is False+++class _FakeTkRoot:+ """A toplevel whose outer window exists only after its first map."""++ def __init__(self) -> None:+ self.bindings: list[tuple[str, object, str]] = []++ def winfo_id(self) -> int:+ return 0x1111++ def bind(self, sequence: str, func, add: str = "") -> None:+ self.bindings.append((sequence, func, add))++ def fire_map(self, widget=None) -> None:+ for sequence, func, _add in self.bindings:+ if sequence == "<Map>":+ func(SimpleNamespace(widget=self if widget is None else widget))+++def test_unmapped_tk_window_is_excluded_once_tk_creates_its_outer_window(monkeypatch) -> None:+ """The overlays exclude themselves before their first show, when Tk has no+ outer window yet; the exclusion landed on the inner child and the mascot+ stayed in every appshot."""+ fake = _FakeUser32()+ monkeypatch.setattr(exclusion.sys, "platform", "win32")+ monkeypatch.setattr(exclusion, "_user32", lambda: fake)+ root = _FakeTkRoot()++ assert exclusion.exclude_tk_window_from_capture(root) is True+ assert fake.affinity == [], "the inner child cannot carry a display affinity"++ fake.parent_of[0x1111] = 0x2222 # Tk maps the toplevel: the outer window exists+ root.fire_map()+ assert fake.affinity == [(0x2222, 0x00000011)]+++def test_map_hook_keeps_foreign_bindings_and_ignores_child_widgets(monkeypatch) -> None:+ fake = _FakeUser32()+ fake.parent_of[0x1111] = 0x2222+ monkeypatch.setattr(exclusion.sys, "platform", "win32")+ monkeypatch.setattr(exclusion, "_user32", lambda: fake)+ root = _FakeTkRoot()++ exclusion.exclude_tk_window_from_capture(root)+ exclusion.exclude_tk_window_from_capture(root)++ assert [b for b in root.bindings if b[0] == "<Map>"] == [root.bindings[0]], "bound once"+ assert root.bindings[0][2] == "+", "an existing <Map> binding is never replaced"+ fake.affinity.clear()+ root.fire_map(widget=object()) # a child label mapping+ assert fake.affinity == []+ root.fire_map() # the toplevel itself (re-)mapping+ assert fake.affinity == [(0x2222, 0x00000011)]