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(macos): clear native window backing — Tk 9 paints systemTransparent opaque (BUG-069)
Joana Lütkee969f2b2cec0
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 0b5782d9f6..9421b7a393 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -5336,3 +5336,35 @@ path; Linux/Windows byte-identical. Verified live: the host reachesframework to touch `NSApplication`. Never call a pyobjc/AppKit API beforethe first `Tk()` in Tk-hosting subprocesses — and treat "works with Tk 8.6"as unproven for Tk 9.++---++## BUG-075: solid grey box around the bar/mascot on macOS — Tk 9 no longer maps systemTransparent to a clear backing (MEDIUM, FIXED 2026-07-17)++> Shipped in the 2026-07-17 public-repo (Mac session) commits as "BUG-069";+> renumbered on integration — the local register had already assigned BUG-069+> to an unrelated realtime-speech bug.++**Symptom.** The JarvisBar rendered inside an opaque grey rectangle on the+freshly installed Mac (screenshot from the maintainer's first live session).++**Root cause.** The Aqua-Tk transparency recipe (`wm attributes -transparent`++ `systemTransparent` background) is a Tk 8.6 behavior. Tk 9 — bundled by+uv's python-build-standalone, i.e. every fresh macOS install — accepts both+calls without error but paints `systemTransparent` as an opaque appearance+color, so the window backing shows as a grey box around the RGBA artwork.+Silent break: no TclError, so the key-color fallback never fired.++**Fix (2026-07-17).** After the Tk window exists, the overlay clears the+native backing itself via pyobjc (`NSWindow.setOpaque_(False)` ++`clearColor` background + no shadow) — the Tk-version-independent+equivalent of what Tk 8.6 did internally. Applied in the bar+(`jarvis/ui/jarvisbar/overlay.py::_apply_macos_clear_backing`), the orb+main window, and the comment bubble (`ui/orb/overlay.py::+apply_macos_clear_backing`); darwin-only, best-effort, the grey box is the+degrade. Safe post-BUG-074 (Tk owns NSApp before any window exists in the+host).++**Class rule.** Aqua-Tk cosmetics verified on Tk 8.6 are unproven on Tk 9 —+and the failure mode is silent (no TclError). Where the effect matters,+assert it natively via AppKit instead of trusting a Tk color name.diff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.pyindex f1ce872a25..33da96ef31 100644--- a/jarvis/ui/jarvisbar/overlay.py+++ b/jarvis/ui/jarvisbar/overlay.py@@ -177,6 +177,35 @@ def _primary_work_area() -> tuple[int, int, int, int] | None:return None+def _apply_macos_clear_backing() -> None:+ """Make every NSWindow of THIS process paint a clear backing (BUG-075).++ Tk 8.6 aqua turned the ``systemTransparent`` background into true+ per-pixel transparency; Tk 9 (bundled by uv's python-build-standalone,+ i.e. every fresh macOS install) paints it as an opaque appearance color+ instead — the bar showed a solid grey box around the pill. Setting the+ window backing non-opaque with a clear background is the native,+ Tk-version-independent way to get the same effect; the RGBA frames the+ renderer already produces then composite correctly.++ Applied to ALL windows deliberately: this runs only inside the overlay+ host process, whose every window (bar, mascot, comment bubble) wants a+ clear backing. Safe post-BUG-067: Tk owns ``NSApp`` by the time any+ window exists. Best-effort, never raises.+ """+ if sys.platform != "darwin":+ return+ try:+ from AppKit import NSApp, NSColor # type: ignore[import-not-found] # noqa: PLC0415++ for win in NSApp.windows():+ win.setOpaque_(False)+ win.setBackgroundColor_(NSColor.clearColor())+ win.setHasShadow_(False)+ except Exception: # noqa: BLE001 — cosmetic; the grey box is the degrade+ log.debug("macOS clear-backing pass skipped", exc_info=True)++def _create_hidden_tk_root(tk: Any) -> Any:"""Create a Tk root without mapping its platform-default backing window.@@ -601,6 +630,11 @@ class JarvisBarOverlay:borderwidth=0,)self._canvas.pack(fill="both", expand=True)+ if self._mac_transparent:+ # Tk 9 needs the native backing cleared too (BUG-075); the window+ # must exist first, so flush geometry before the AppKit pass.+ root.update_idletasks()+ _apply_macos_clear_backing()self._canvas.bind("<ButtonPress-1>", self._on_press)self._canvas.bind("<B1-Motion>", self._on_motion)self._canvas.bind("<ButtonRelease-1>", self._on_release)diff --git a/tests/unit/ui/jarvisbar/test_dpi_awareness.py b/tests/unit/ui/jarvisbar/test_dpi_awareness.pyindex 72f45b2d1d..2997cc760b 100644--- a/tests/unit/ui/jarvisbar/test_dpi_awareness.py+++ b/tests/unit/ui/jarvisbar/test_dpi_awareness.py@@ -33,6 +33,7 @@ class _FakeTkRoot:def deiconify(self) -> None: ...def after(self, *a, **k) -> None: ...def mainloop(self) -> None: ...+ def update_idletasks(self) -> None: ...class _FakeCanvas:diff --git a/ui/orb/overlay.py b/ui/orb/overlay.pyindex 3ad572b4b6..4882cb6725 100644--- a/ui/orb/overlay.py+++ b/ui/orb/overlay.py@@ -170,6 +170,35 @@ def key_to_alpha(img: Image.Image) -> Image.Image:return Image.fromarray(np.dstack((arr, alpha)), "RGBA")+def apply_macos_clear_backing() -> None:+ """Make every NSWindow of THIS process paint a clear backing (BUG-075).++ Tk 8.6 aqua turned the ``systemTransparent`` background into true+ per-pixel transparency; Tk 9 (bundled by uv's python-build-standalone)+ paints it as an opaque appearance color instead — the surface showed a+ solid grey box around its artwork. A non-opaque window backing with a+ clear background is the native, Tk-version-independent equivalent.+ Runs only inside the overlay host process, whose every window wants a+ clear backing. Safe post-BUG-067: Tk owns ``NSApp`` before any window+ exists here. Best-effort, never raises.+ """+ if sys.platform != "darwin":+ return+ try:+ from AppKit import NSApp, NSColor # type: ignore[import-not-found] # noqa: PLC0415++ for win in NSApp.windows():+ win.setOpaque_(False)+ win.setBackgroundColor_(NSColor.clearColor())+ win.setHasShadow_(False)+ except Exception: # noqa: BLE001 — cosmetic; the grey box is the degrade+ import logging # noqa: PLC0415++ logging.getLogger("jarvis.orb").debug(+ "macOS clear-backing pass skipped", exc_info=True+ )++_GWL_EXSTYLE = -20_WS_EX_APPWINDOW = 0x00040000_WS_EX_TOOLWINDOW = 0x00000080@@ -968,6 +997,11 @@ class OrbCommentBubble:borderwidth=0,)canvas.pack(fill="both", expand=True)+ if self._mac_transparent:+ # New Toplevel = new NSWindow — give it the clear backing too+ # (BUG-075).+ top.update_idletasks()+ apply_macos_clear_backing()self._top = topself._canvas = canvas@@ -1462,6 +1496,11 @@ class OrbOverlay:borderwidth=0,)self._canvas.pack(fill="both", expand=True)+ if self._mac_transparent:+ # Tk 9 needs the native backing cleared too (BUG-075); flush+ # geometry so the NSWindow exists before the AppKit pass.+ self._root.update_idletasks()+ apply_macos_clear_backing()# Drag + interaction bindings. Tk dispatch:# <Button-1> → drag-start (always fires, even on a double-click)