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
feat(pets): the control strip floats on the desktop with no background
rubenluetke10-beep2c467ccea561
diff --git a/docs/os-parity.md b/docs/os-parity.mdindex 6f9a884a44..752086f3cd 100644--- a/docs/os-parity.md+++ b/docs/os-parity.md@@ -638,7 +638,7 @@ experiences today.| P-20 | Low | Coding-CLI panes | Kimi Code panes deliberately ship WITHOUT multi-subscription switching, unlike Claude Code and Codex. Three independent reasons, all recorded on the registry entry: the wound-down Python generation ignores `KIMI_CODE_HOME` entirely, so seats created on a machine that has it would all silently resolve to one login; its configuration and its credentials share a single `config.toml`, so no setup can be carried to a new seat without carrying the key with it; and its credential layout is unverified against a live install of the current generation | `jarvis/workspace/agents.py` (the `kimi` entry), `jarvis/agent_accounts.py::platforms` | All OSes: one Kimi login, and the account switcher honestly does not offer the CLI at all rather than showing a switch that does nothing. Unblocked by verifying the current generation's credential layout and gating the override on the generation probe || P-22 | Low | Orb window | The floating orb window (both looks: the Gigi mascot and the procedural **voice orb**) is a Tk window whose transparency comes from a colour key. Windows keys it out natively; macOS uses Aqua-Tk's `-transparent` in the companion host; on Linux the attribute is accepted only under a **compositing** window manager, and not at all on Wayland | `ui/orb/overlay.py::_apply_color_key`, `_build_renderer`, `jarvis/ui/jarvisbar/host.py::_build_surface` | Windows/macOS: full parity, including drag-to-any-monitor and the live mascot↔voice-orb switch. Linux with a compositor (GNOME/KDE/picom): works. Linux without one, and Wayland: the window would be an opaque magenta square, so it is NOT shown — the surface logs one actionable English line and stays hidden; voice, tray and the app window are unaffected. Note the Jarvis Bar degrades DIFFERENTLY on such a session (it keeps drawing and shows its key colour — pre-existing, the `transparentcolor unsupported` branch in `jarvis/ui/jarvisbar/overlay.py::JarvisBarOverlay.start`), so "None (hidden)" is the honest display style on a non-compositing Linux desktop until the bar adopts the same gate |-| P-44 | Low | Desktop pet | The `pet` display style (an animated pixel-art companion with a control strip and a status bubble, `docs/pets.md`) is a third look of the same orb window, so it inherits P-22's transparency rules. Pixel art has hard edges, so the colour key leaves no fringe. Its shortcut (`[trigger] hotkey_pet_toggle`, default `alt+win+p`, which macOS reads as Cmd+Option+P) goes through the shared hotkey backends. The topmost re-assert and the capture exclusion are Windows-only calls behind a platform check | `ui/orb/overlay.py` (pet style), `ui/orb/pet_renderer.py`, `ui/orb/controls.py` (pet strip), `jarvis/ui/jarvisbar/host.py` / `subprocess_overlay.py` (pet commands), `jarvis/ui/pets/` | Windows: verified live. macOS: the pet runs in the companion host over the existing protocol (contract-tested, not run live). Linux with a compositor: expected to work (not run live); without one, and Wayland: hidden like P-22, and the shortcut is a no-op on Wayland. Headless: no window; the Pets settings page and `/api/pets` still work |+| P-44 | Low | Desktop pet | The `pet` display style (an animated pixel-art companion with a control strip and a status bubble, `docs/pets.md`) is a third look of the same orb window, so it inherits P-22's transparency rules. Pixel art has hard edges, so the colour key leaves no fringe. The control strip has no background where the window carries per-pixel alpha: Windows feeds it through `UpdateLayeredWindow` (`jarvis/platform/layered_window.py`; alpha-1 areas keep its controls clickable), macOS draws the RGBA frame on the transparent backing, and every other platform keeps the colour-keyed dark strip. Its shortcut (`[trigger] hotkey_pet_toggle`, default `alt+win+p`, which macOS reads as Cmd+Option+P) goes through the shared hotkey backends. The topmost re-assert and the capture exclusion are Windows-only calls behind a platform check | `ui/orb/overlay.py` (pet style), `ui/orb/pet_renderer.py`, `ui/orb/controls.py` (pet strip), `jarvis/ui/jarvisbar/host.py` / `subprocess_overlay.py` (pet commands), `jarvis/ui/pets/` | Windows: verified live. macOS: the pet runs in the companion host over the existing protocol (contract-tested, not run live). Linux with a compositor: expected to work (not run live); without one, and Wayland: hidden like P-22, and the shortcut is a no-op on Wayland. Headless: no window; the Pets settings page and `/api/pets` still work || P-21 | Low | Coding-CLI panes | OpenCode panes ship single-login for the same class of reason: the only variable that moves its credentials and session database is `XDG_DATA_HOME`, which is a SHARED variable rather than a dedicated override — redirecting it per pane would also redirect any other XDG-aware tool the agent spawns inside that pane | `jarvis/workspace/agents.py` (the `opencode` entry) | All OSes: one OpenCode login. Verified on Windows that `XDG_DATA_HOME` does move `auth.json` and the session database; the blast radius on macOS and Linux has not been measured, which is why it is not wired up || P-38 | Low | Coding-CLI panes | Antigravity (`agy`) panes ship single-login. `GEMINI_HOME` would move the login, but it is a shared variable (the Gemini CLI, mission workers and the pane would all follow it), and `agy` has no `login` subcommand to point at an account directory — sign-in lives on the API-Keys page. The installer is OS-split (`install.ps1` on Windows, `install.sh` elsewhere); the binary also lands in `%LOCALAPPDATA%\agy\bin` on Windows, which `path_augment` already probes | `jarvis/workspace/agents.py` (the `antigravity` entry), `jarvis/google_cli/auth_service.py`, `jarvis/core/path_augment.py` | All OSes: one Google login, and the account switcher does not offer the CLI. Unblocked by a dedicated override that does not also redirect the Gemini CLI || P-39 | Low | Coding-CLI panes | Cursor CLI panes ship single-login. Sign-in is `agent login` (browser) or `CURSOR_API_KEY`; the on-disk layout of that store has not been verified against a live install, so a seat switcher would report switches that did not happen. The installer is OS-split (`https://cursor.com/install?win32=true` on native Windows, `https://cursor.com/install` on macOS/Linux/WSL); the binary lands in `~/.local/bin` as `agent`, with `cursor-agent` as the unambiguous Windows alias | `jarvis/workspace/agents.py` (the `cursor` entry) | All OSes: one Cursor login, and the account switcher does not offer the CLI. Unblocked by verifying the login store and a dedicated override |@@ -1072,4 +1072,4 @@ same two-second setup delay and background noise removed the old two-secondsteady input lag. Paired GPT-Live probes retained the same recognized words inGerman and English, including a quieter English sample. First response textarrived 0.4–1.4 seconds earlier in those three comparisons; these small-synthetic comparisons are not a physical-device latency guarantee.+synthetic comparisons are not a physical-device latency guarantee.\ No newline at end of filediff --git a/docs/pets.md b/docs/pets.mdindex 7646f7b2a9..c3985f9978 100644--- a/docs/pets.md+++ b/docs/pets.md@@ -18,7 +18,10 @@ one click.- **The figure.** It reacts to Jarvis in real time (see *States*). It can bedragged anywhere, and its position is remembered per monitor(`[overlay.mascot] position_*`, shared with the mascot).-- **The control strip** under the figure, from left to right:+- **The control strip** under the figure. Where the window carries per-pixel+ alpha it has no background of its own: the glyphs and the indicator float+ on the desktop with a soft shadow, and each control's round area stays+ clickable while invisible. From left to right:- pen: raise the main window and open a new chat (`ComposeRequested`);- microphone: mute Jarvis's microphone (`VoiceMuteToggleRequested`, mirroredfrom `VoiceMuteChanged`);@@ -264,4 +267,4 @@ The pet must cost next to nothing while idle:boundary: 6 fps idle, 3 fps asleep, 8–10 fps active, nothing while hidden;- the control strip's indicator animates only while listening, talking or thinking.-Target: an idle pet adds less than 1 % of one CPU core to the app process.+Target: an idle pet adds less than 1 % of one CPU core to the app process.\ No newline at end of filediff --git a/jarvis/platform/layered_window.py b/jarvis/platform/layered_window.pynew file mode 100644index 0000000000..0e6f583b0a--- /dev/null+++ b/jarvis/platform/layered_window.py@@ -0,0 +1,227 @@+"""Per-pixel alpha for a Tk toplevel on Windows (``UpdateLayeredWindow``).++Tk's ``-transparentcolor`` keys ONE colour out: a pixel is either fully shown+or fully gone, so soft edges and see-through controls are impossible, and a+keyed pixel does not take clicks. A layered window fed through+``UpdateLayeredWindow`` instead shows a premultiplied BGRA bitmap with real+per-pixel alpha, and every pixel whose alpha is above zero still receives the+mouse — so a control can be practically invisible (alpha 1/255) and clickable.++Windows only, behind :func:`per_pixel_alpha_supported`; every other platform+gets ``False`` from each call and keeps its own path. Once a window is fed+through ``UpdateLayeredWindow`` it must never also get+``SetLayeredWindowAttributes`` (Tk's ``-transparentcolor`` / ``-alpha``): the+two modes exclude each other.+"""++from __future__ import annotations++import logging+import sys+from typing import Any++from PIL import Image, ImageChops++log = logging.getLogger(__name__)++_GWL_EXSTYLE = -20+_WS_EX_LAYERED = 0x00080000+_ULW_ALPHA = 0x00000002+_AC_SRC_OVER = 0x00+_AC_SRC_ALPHA = 0x01+_DIB_RGB_COLORS = 0++_api: Any | None = None+++def per_pixel_alpha_supported() -> bool:+ """True where :func:`update_layered` can work (Windows)."""+ return sys.platform == "win32"+++def _load() -> Any:+ """ctypes bindings, built once. Explicit argtypes: handles are 64-bit."""+ global _api+ if _api is not None:+ return _api+ import ctypes # noqa: PLC0415 — Windows-only path+ from ctypes import wintypes # noqa: PLC0415++ class BITMAPINFOHEADER(ctypes.Structure):+ _fields_ = [+ ("biSize", wintypes.DWORD),+ ("biWidth", wintypes.LONG),+ ("biHeight", wintypes.LONG),+ ("biPlanes", wintypes.WORD),+ ("biBitCount", wintypes.WORD),+ ("biCompression", wintypes.DWORD),+ ("biSizeImage", wintypes.DWORD),+ ("biXPelsPerMeter", wintypes.LONG),+ ("biYPelsPerMeter", wintypes.LONG),+ ("biClrUsed", wintypes.DWORD),+ ("biClrImportant", wintypes.DWORD),+ ]++ class BLENDFUNCTION(ctypes.Structure):+ _fields_ = [+ ("BlendOp", ctypes.c_ubyte),+ ("BlendFlags", ctypes.c_ubyte),+ ("SourceConstantAlpha", ctypes.c_ubyte),+ ("AlphaFormat", ctypes.c_ubyte),+ ]++ user32 = ctypes.WinDLL("user32", use_last_error=True)+ gdi32 = ctypes.WinDLL("gdi32", use_last_error=True)+ handle = ctypes.c_void_p+ user32.GetParent.argtypes = [handle]+ user32.GetParent.restype = handle+ user32.GetDC.argtypes = [handle]+ user32.GetDC.restype = handle+ user32.ReleaseDC.argtypes = [handle, handle]+ user32.ReleaseDC.restype = ctypes.c_int+ user32.GetWindowLongPtrW.argtypes = [handle, ctypes.c_int]+ user32.GetWindowLongPtrW.restype = ctypes.c_ssize_t+ user32.SetWindowLongPtrW.argtypes = [handle, ctypes.c_int, ctypes.c_ssize_t]+ user32.SetWindowLongPtrW.restype = ctypes.c_ssize_t+ user32.UpdateLayeredWindow.argtypes = [+ handle,+ handle,+ ctypes.POINTER(wintypes.POINT),+ ctypes.POINTER(wintypes.SIZE),+ handle,+ ctypes.POINTER(wintypes.POINT),+ wintypes.DWORD,+ ctypes.POINTER(BLENDFUNCTION),+ wintypes.DWORD,+ ]+ user32.UpdateLayeredWindow.restype = wintypes.BOOL+ gdi32.CreateCompatibleDC.argtypes = [handle]+ gdi32.CreateCompatibleDC.restype = handle+ gdi32.DeleteDC.argtypes = [handle]+ gdi32.DeleteDC.restype = wintypes.BOOL+ gdi32.CreateDIBSection.argtypes = [+ handle,+ ctypes.POINTER(BITMAPINFOHEADER),+ wintypes.UINT,+ ctypes.POINTER(ctypes.c_void_p),+ handle,+ wintypes.DWORD,+ ]+ gdi32.CreateDIBSection.restype = handle+ gdi32.SelectObject.argtypes = [handle, handle]+ gdi32.SelectObject.restype = handle+ gdi32.DeleteObject.argtypes = [handle]+ gdi32.DeleteObject.restype = wintypes.BOOL++ class Api:+ pass++ api = Api()+ api.ctypes = ctypes+ api.wintypes = wintypes+ api.user32 = user32+ api.gdi32 = gdi32+ api.BITMAPINFOHEADER = BITMAPINFOHEADER+ api.BLENDFUNCTION = BLENDFUNCTION+ _api = api+ return api+++def tk_toplevel_hwnd(top: Any) -> int:+ """The real top-level HWND of a Tk toplevel (``winfo_id`` is its child)."""+ if not per_pixel_alpha_supported():+ return 0+ try:+ inner = int(top.winfo_id())+ parent = _load().user32.GetParent(inner)+ return int(parent or inner)+ except Exception: # noqa: BLE001 — a missing handle degrades to "no alpha"+ log.debug("could not resolve the toplevel HWND", exc_info=True)+ return 0+++def enable_per_pixel_alpha(hwnd: int) -> bool:+ """Mark ``hwnd`` as a layered window. True on success."""+ if not per_pixel_alpha_supported() or not hwnd:+ return False+ try:+ user32 = _load().user32+ style = user32.GetWindowLongPtrW(hwnd, _GWL_EXSTYLE)+ if not style & _WS_EX_LAYERED:+ user32.SetWindowLongPtrW(hwnd, _GWL_EXSTYLE, style | _WS_EX_LAYERED)+ return True+ except Exception: # noqa: BLE001 — degrade to the colour-key path+ log.debug("could not make hwnd=%s layered", hwnd, exc_info=True)+ return False+++def premultiplied_bgra(image: Image.Image) -> bytes:+ """``image`` as top-down premultiplied BGRA bytes, the layout GDI wants."""+ rgba = image.convert("RGBA")+ r, g, b, a = rgba.split()+ return Image.merge(+ "RGBA",+ (ImageChops.multiply(b, a), ImageChops.multiply(g, a), ImageChops.multiply(r, a), a),+ ).tobytes()+++def update_layered(hwnd: int, image: Image.Image) -> bool:+ """Show ``image`` (RGBA, real alpha) as the whole content of ``hwnd``.++ Leaves the window's position alone (Tk keeps placing it) and sets its+ size to the image's. True when Windows accepted the frame.+ """+ if not per_pixel_alpha_supported() or not hwnd:+ return False+ try:+ api = _load()+ except Exception: # noqa: BLE001+ log.debug("layered-window bindings unavailable", exc_info=True)+ return False+ ctypes, wintypes = api.ctypes, api.wintypes+ width, height = image.size+ data = premultiplied_bgra(image)+ screen = api.user32.GetDC(None)+ memdc = api.gdi32.CreateCompatibleDC(screen)+ bitmap = None+ old = None+ try:+ header = api.BITMAPINFOHEADER()+ header.biSize = ctypes.sizeof(api.BITMAPINFOHEADER)+ header.biWidth = width+ header.biHeight = -height # top-down rows+ header.biPlanes = 1+ header.biBitCount = 32+ header.biCompression = 0 # BI_RGB+ bits = ctypes.c_void_p()+ bitmap = api.gdi32.CreateDIBSection(+ screen, ctypes.byref(header), _DIB_RGB_COLORS, ctypes.byref(bits), None, 0+ )+ if not bitmap or not bits.value:+ return False+ ctypes.memmove(bits, data, len(data))+ old = api.gdi32.SelectObject(memdc, bitmap)+ size = wintypes.SIZE(width, height)+ origin = wintypes.POINT(0, 0)+ blend = api.BLENDFUNCTION(_AC_SRC_OVER, 0, 255, _AC_SRC_ALPHA)+ ok = api.user32.UpdateLayeredWindow(+ hwnd,+ screen,+ None,+ ctypes.byref(size),+ memdc,+ ctypes.byref(origin),+ 0,+ ctypes.byref(blend),+ _ULW_ALPHA,+ )+ if not ok:+ log.debug("UpdateLayeredWindow refused hwnd=%s (err %s)", hwnd, ctypes.get_last_error())+ return bool(ok)+ finally:+ if old:+ api.gdi32.SelectObject(memdc, old)+ if bitmap:+ api.gdi32.DeleteObject(bitmap)+ api.gdi32.DeleteDC(memdc)+ api.user32.ReleaseDC(None, screen)diff --git a/tests/unit/platform/test_layered_window.py b/tests/unit/platform/test_layered_window.pynew file mode 100644index 0000000000..3cf2b3c6c7--- /dev/null+++ b/tests/unit/platform/test_layered_window.py@@ -0,0 +1,36 @@+"""``jarvis.platform.layered_window`` — per-pixel alpha for Tk windows."""++from __future__ import annotations++import sys++import pytest+from PIL import Image++from jarvis.platform import layered_window+++def test_premultiplied_bgra_orders_and_scales_the_channels() -> None:+ img = Image.new("RGBA", (1, 1), (200, 100, 50, 128))+ b, g, r, a = layered_window.premultiplied_bgra(img)+ assert a == 128+ assert (b, g, r) == (round(50 * 128 / 255), round(100 * 128 / 255), round(200 * 128 / 255))+++def test_a_transparent_pixel_is_all_zero() -> None:+ assert layered_window.premultiplied_bgra(+ Image.new("RGBA", (2, 1), (255, 255, 255, 0))+ ) == bytes(8)++[email protected](sys.platform == "win32", reason="the no-op path is for other platforms")+def test_every_call_is_a_quiet_no_op_off_windows() -> None:+ assert layered_window.per_pixel_alpha_supported() is False+ assert layered_window.tk_toplevel_hwnd(object()) == 0+ assert layered_window.enable_per_pixel_alpha(123) is False+ assert layered_window.update_layered(123, Image.new("RGBA", (1, 1))) is False+++def test_a_missing_window_is_refused_without_raising() -> None:+ assert layered_window.enable_per_pixel_alpha(0) is False+ assert layered_window.update_layered(0, Image.new("RGBA", (1, 1))) is Falsediff --git a/tests/unit/ui/test_orb_controls_pet.py b/tests/unit/ui/test_orb_controls_pet.pyindex c350696387..d86a51d423 100644--- a/tests/unit/ui/test_orb_controls_pet.py+++ b/tests/unit/ui/test_orb_controls_pet.py@@ -327,3 +327,42 @@ def test_hover_lifts_a_round_patch_not_the_whole_slot() -> None:# The slot's top corner stays the plain fill; its middle edge lightens.assert hovered.getpixel((sx0 + 1, y0 + 1)) == plain.getpixel((sx0 + 1, y0 + 1))assert hovered.getpixel(((sx0 + sx1) // 2, y0 + 5)) == controls.PET_FILL_HOVER+++# --- the see-through strip (per-pixel alpha) ----------------------------------------+++def test_the_see_through_strip_has_no_background() -> None:+ frame = controls.render_pet_strip_rgba(controls.PetStripState(), 1.0)+ assert frame.mode == "RGBA"+ layout = controls.pet_strip_layout(1.0)+ _x0, y0, _x1, y1 = layout.pill+ _action, sx0, _sx1 = layout.slots[0]+ # Inside the pill but away from any mark: invisible yet clickable.+ assert frame.getpixel((sx0 + 2, (y0 + y1) // 2))[3] == controls.PET_HIT_ALPHA+ # Outside every control: fully transparent, the desktop takes the click.+ assert frame.getpixel((0, 0))[3] == 0+ # The marks themselves are opaque.+ assert frame.getchannel("A").getextrema()[1] == 255+++def test_the_see_through_strip_lifts_the_hovered_control() -> None:+ plain = controls.render_pet_strip_rgba(controls.PetStripState(), 1.0)+ hovered = controls.render_pet_strip_rgba(controls.PetStripState(hovered="speaker"), 1.0)+ layout = controls.pet_strip_layout(1.0)+ _action, sx0, sx1 = layout.slots[2]+ _x0, y0, _x1, _y1 = layout.pill+ probe = ((sx0 + sx1) // 2, y0 + 4)+ assert plain.getpixel(probe)[3] == controls.PET_HIT_ALPHA+ assert hovered.getpixel(probe)[3] > 30+++def test_the_see_through_indicator_follows_the_voice() -> None:+ def opaque(frame) -> int:+ return sum(1 for px in frame.getdata() if px[3] > 200)++ rest = controls.render_pet_strip_rgba(controls.PetStripState(), 2.0)+ loud = controls.render_pet_strip_rgba(+ controls.PetStripState(active=True, motion="voice", level=6), 2.0+ )+ assert opaque(loud) > opaque(rest)diff --git a/ui/orb/controls.py b/ui/orb/controls.pyindex 803b7023c2..3c6c25ab06 100644--- a/ui/orb/controls.py+++ b/ui/orb/controls.py@@ -36,7 +36,7 @@ import threadingfrom collections.abc import Callable, Sequencefrom dataclasses import dataclass-from PIL import Image, ImageDraw+from PIL import Image, ImageChops, ImageDraw, ImageFilter# --- Palette (the app's dark theme, flattened) ------------------------------#: Resting disc: ``bg-background/85`` over the desktop reads as a near-black@@ -917,6 +917,148 @@ def render_pet_strip(return frame+# --- the see-through strip (per-pixel alpha) ----------------------------------+# Where the window can carry real alpha (``jarvis.platform.layered_window`` on+# Windows, the transparent backing on macOS) the strip has no background at+# all: the glyphs and the indicator float on the desktop. A tight dark shadow+# under them keeps white marks readable on a light wallpaper, and each+# control's round area is painted at alpha 1/255 — invisible, but a pixel+# above zero still takes the click, so a press between two strokes of a glyph+# is not lost to the desktop.+#+# A frame is two cached layers composited: the still part (hit areas, hover,+# glyphs) keyed by the mute flags and the hovered control, and the moving+# indicator keyed by (motion, level, phase). Compositing two RGBA images is a+# fraction of a millisecond, so a moving indicator never re-blurs the glyphs.++#: Alpha of the invisible click areas (the smallest value that still hits).+PET_HIT_ALPHA = 1+#: The hover lift: a faint neutral disc behind the control under the pointer,+#: visible on a dark and on a light desktop alike.+PET_HOVER_RGBA = (150, 158, 176, 64)+#: The mark shadow: a crisp contour plus a soft halo (logical px blur radii)+#: and how dark each gets at full strength (0..255).+PET_SHADOW_TIGHT_BLUR = 0.9+PET_SHADOW_TIGHT_ALPHA = 210+PET_SHADOW_SOFT_BLUR = 2.4+PET_SHADOW_SOFT_ALPHA = 90+#: Indicator opacity for a fully dimmed stroke; glow 1.0 is fully opaque.+PET_INDICATOR_MIN_ALPHA = 0.42+++def _clear_slots(layout: PetStripLayout) -> list[tuple[str, float, float, float]]:+ """Every control as ``(action, cx, cy, radius)`` in window pixels."""+ pcx, pcy, pr = layout.pen+ _x0, y0, _x1, y1 = layout.pill+ cy = (y0 + y1) / 2.0+ r = (y1 - y0) / 2.0+ out = [("compose", pcx, pcy, pr)]+ out += [(action, (sx0 + sx1) / 2.0, cy, r) for action, sx0, sx1 in layout.slots]+ return out+++def _with_shadow(marks: Image.Image, scale: float) -> Image.Image:+ """``marks`` over a dark contour and halo derived from their own alpha."""+ alpha = marks.getchannel("A")+ s = max(0.5, scale)++ def _shade(blur: float, strength: int) -> Image.Image:+ return alpha.filter(ImageFilter.GaussianBlur(blur * s)).point(+ lambda v: min(255, int(v * strength / 255 * 1.8))+ )++ shade = ImageChops.lighter(+ _shade(PET_SHADOW_TIGHT_BLUR, PET_SHADOW_TIGHT_ALPHA),+ _shade(PET_SHADOW_SOFT_BLUR, PET_SHADOW_SOFT_ALPHA),+ )+ shadow = Image.new("RGBA", marks.size, (0, 0, 0, 0))+ shadow.putalpha(shade)+ return Image.alpha_composite(shadow, marks)++[email protected]_cache(maxsize=32)+def _strip_still_rgba(+ mic_muted: bool, speaker_muted: bool, hovered: str | None, scale: float+) -> Image.Image:+ """Hit areas, hover lift and the three glyphs with their shadow."""+ layout = pet_strip_layout(scale)+ size = (layout.width, layout.height)+ controls = _clear_slots(layout)+ state = PetStripState(mic_muted=mic_muted, speaker_muted=speaker_muted)++ base = Image.new("RGBA", size, (0, 0, 0, 0))+ bd = ImageDraw.Draw(base)+ for action, cx, cy, r in controls:+ fill = PET_HOVER_RGBA if hovered == action else (0, 0, 0, PET_HIT_ALPHA)+ bd.ellipse([cx - r, cy - r, cx + r, cy + r], fill=fill)+ # The pill between its controls stays grabbable for a drag.+ x0, y0, x1, y1 = layout.pill+ hit = Image.new("L", size, 0)+ ImageDraw.Draw(hit).rounded_rectangle(+ [x0, y0, x1 - 1, y1 - 1], radius=(y1 - y0 - 1) / 2.0, fill=PET_HIT_ALPHA+ )+ base.putalpha(ImageChops.lighter(base.getchannel("A"), hit))++ big = (layout.width * _SS, layout.height * _SS)+ glyphs = Image.new("RGBA", big, (0, 0, 0, 0))+ gd = ImageDraw.Draw(glyphs)+ pill_h = y1 - y0+ for action, cx, cy, _r in controls:+ if action == "orb":+ continue+ box = (_spx(PET_SLOT, scale) if action == "compose" else pill_h) * PET_ICON_BOX * _SS+ stroke = PET_ICON_STROKE * max(0.5, scale) * _SS+ _draw_glyph(action, gd, cx * _SS, cy * _SS, box, stroke, state)+ glyphs = glyphs.resize(size, Image.Resampling.LANCZOS)+ return Image.alpha_composite(base, _with_shadow(glyphs, scale))++[email protected]_cache(maxsize=128)+def _strip_indicator_rgba(motion: str, level: int, phase: int, scale: float) -> Image.Image:+ """The three cloud strokes with their shadow; dimming lowers their alpha."""+ layout = pet_strip_layout(scale)+ size = (layout.width, layout.height)+ _x0, y0, _x1, y1 = layout.pill+ orb = next(c for c in _clear_slots(layout) if c[0] == "orb")+ pill_h = (y1 - y0) * _SS+ cx, cy = orb[1] * _SS, orb[2] * _SS+ big = Image.new("RGBA", (layout.width * _SS, layout.height * _SS), (0, 0, 0, 0))+ width = max(2, int(round(2.0 * pill_h * PET_INDICATOR_HALF_W)))+ tallest = max(width, int(round(pill_h * PET_INDICATOR_MAX_H)))+ step = pill_h * PET_INDICATOR_SPACING+ first = cx - step * (PET_INDICATOR_BARS - 1) / 2.0+ state = PetStripState(motion=motion, level=level, phase=phase)+ for i, (share, glow) in enumerate(indicator_bars(state)):+ h = min(tallest, max(width, int(round(pill_h * share))))+ top = (tallest - h) // 2+ stroke = _cloud_texture(i, width, tallest).crop((0, top, width, top + h)).convert("RGBA")+ opacity = PET_INDICATOR_MIN_ALPHA + (1.0 - PET_INDICATOR_MIN_ALPHA) * max(+ 0.0, min(1.0, glow)+ )+ stroke.putalpha(_stroke_mask(width, h).point(lambda v, o=opacity: int(round(v * o))))+ big.alpha_composite(+ stroke, (int(round(first + i * step - width / 2.0)), int(round(cy - h / 2.0)))+ )+ return _with_shadow(big.resize(size, Image.Resampling.LANCZOS), scale)++[email protected]_cache(maxsize=256)+def render_pet_strip_rgba(state: PetStripState, scale: float = 1.0) -> Image.Image:+ """The pet strip with no background, as RGBA with real alpha.++ For windows that support per-pixel alpha. Same layout and hit areas as+ :func:`render_pet_strip`; cached per state. Callers must not mutate the+ returned image.+ """+ motion = state.motion if state.motion in PET_MOTIONS else "rest"+ level = state.level if motion == "voice" else 0+ phase = state.phase if motion != "rest" else 0+ return Image.alpha_composite(+ _strip_still_rgba(state.mic_muted, state.speaker_muted, state.hovered, scale),+ _strip_indicator_rgba(motion, level, phase, scale),+ )++def toggle_speaker_mute(source: str = "orb") -> bool | None:"""Mute / unmute the assistant's voice for this session. Returns the new state.diff --git a/ui/orb/overlay.py b/ui/orb/overlay.pyindex fae52525fe..07208b875e 100644--- a/ui/orb/overlay.py+++ b/ui/orb/overlay.py@@ -67,6 +67,7 @@ from PIL import Image, ImageDraw, ImageFilter, ImageTkfrom jarvis.core.config import DEFAULT_CONFIG_FILE as JARVIS_TOML_PATHfrom jarvis.core.win32_dpi import ensure_dpi_awareness as _ensure_dpi_awareness+from jarvis.platform import layered_windowfrom jarvis.ui.jarvisbar.modes import MODESfrom jarvis.ui.overlay_styles import LEGACY_STYLE_ALIASES, ORB_STYLES, PERSISTENT_ORB_STYLESfrom jarvis.ui.pets.states import DEFAULT_PET_ID, NO_PET_ID, ONE_SHOT_STATES@@ -2122,6 +2123,10 @@ class OrbControlRow:def _row_y(self) -> int:return self._orb_y + self._orb_h + orb_controls.ROW_GAP_FROM_ORB+ def _render_rgba(self) -> Image.Image | None:+ """The row with real alpha, for a per-pixel-alpha window; None = keyed only."""+ return None+# -- wiring ---------------------------------------------------------def set_on_action(self, callback: Callable[[str], None] | None) -> None:@@ -2133,6 +2138,10 @@ class OrbControlRow:top.overrideredirect(True)top.wm_attributes("-topmost", True)self._mac_transparent = False+ # A Windows window fed through UpdateLayeredWindow (real per-pixel+ # alpha); 0 = the colour-key path. The two modes exclude each other,+ # so a window that gets one never gets ``-transparentcolor``.+ self._alpha_hwnd = 0if sys.platform == "darwin":try:top.wm_attributes("-transparent", True)@@ -2144,7 +2153,19 @@ class OrbControlRow:)top.configure(bg=COLOR_KEY_HEX)else:- top.wm_attributes("-transparentcolor", COLOR_KEY_HEX)+ first = self._render_rgba()+ if first is not None and layered_window.per_pixel_alpha_supported():+ top.update_idletasks()+ hwnd = layered_window.tk_toplevel_hwnd(top)+ # The first frame goes in right away: Windows refuses the very+ # first UpdateLayeredWindow (error 87) once the window has been+ # withdrawn, and accepts every later one after this.+ if layered_window.enable_per_pixel_alpha(hwnd) and layered_window.update_layered(+ hwnd, first+ ):+ self._alpha_hwnd = hwnd+ if not self._alpha_hwnd:+ top.wm_attributes("-transparentcolor", COLOR_KEY_HEX)top.configure(bg=COLOR_KEY_HEX)_hide_tk_window_from_task_switcher(top)_exclude_tk_window_from_capture(top)@@ -2225,9 +2246,26 @@ class OrbControlRow:def _repaint(self) -> None:if self._canvas is None:return+ if self._alpha_hwnd:+ rgba = self._render_rgba()+ if rgba is not None and layered_window.update_layered(self._alpha_hwnd, rgba):+ return+ # Windows refused the frame: fall back to the colour key for good.+ logging.getLogger("jarvis.orb").warning(+ "per-pixel alpha refused; the control strip falls back to the colour key"+ )+ self._alpha_hwnd = 0+ if self._top is not None:+ try:+ self._top.wm_attributes("-transparentcolor", COLOR_KEY_HEX)+ except tk.TclError:+ logging.getLogger("jarvis.orb").debug(+ "colour-key fallback failed", exc_info=True+ )try:- frame = self._render_frame()- image = key_to_alpha(frame) if self._mac_transparent else frame+ rgba = self._render_rgba() if self._mac_transparent else None+ frame = rgba if rgba is not None else self._render_frame()+ image = key_to_alpha(frame) if self._mac_transparent and rgba is None else frameself._photo = ImageTk.PhotoImage(image, master=self._canvas)if self._image_id is None:self._image_id = self._canvas.create_image(0, 0, anchor="nw", image=self._photo)@@ -2251,6 +2289,9 @@ class OrbControlRow:except tk.TclError:returnself._visible = True+ if self._alpha_hwnd:+ # A layered window shows its last bitmap; hand it the current one.+ self._repaint()def hide(self) -> None:self._cancel_pending_hide()@@ -2424,6 +2465,10 @@ class PetControlStrip(OrbControlRow):self._state, self._scale, tuple(int(c) for c in COLOR_KEY_RGB))+ def _render_rgba(self) -> Image.Image | None:+ # No background: the glyphs and the indicator float on the desktop.+ return orb_controls.render_pet_strip_rgba(self._state, self._scale)+def _hit(self, x: float, y: float) -> str | None:return orb_controls.pet_hit_test(x, y, self._scale)