Skip to content

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.

feat(orb): give the desktop voice orb the in-app bubble's look and controls

rubenluetke10-beep915375e962ac
diff --git a/jarvis/ui/jarvisbar/host.py b/jarvis/ui/jarvisbar/host.py
index 5ed2f929e5..b02b9a0ad6 100644
--- a/jarvis/ui/jarvisbar/host.py
+++ b/jarvis/ui/jarvisbar/host.py
@@ -224,6 +224,7 @@ class _EchoBar:
def set_on_hangup(self, cb: Any) -> None: ...
def set_feedback_publisher(self, cb: Any) -> None: ...
def set_on_show_window(self, cb: Any) -> None: ...
+ def set_on_speaker_toggle(self, cb: Any) -> None: ...
def __getattr__(self, name: str) -> Any:
if name.startswith("__"):
@@ -379,6 +380,10 @@ def _wire_surface_events(surface: Any) -> None:
_call(surface, "set_on_talk", lambda: emit("talk"))
_call(surface, "set_on_hangup", lambda: emit("hangup"))
_call(surface, "set_on_mute_toggle", lambda: emit("mute_toggle"))
+ # The orb's control row adds one action the bar never had: muting the
+ # ASSISTANT's voice. Like talk/hang-up it needs the parent, because the
+ # SpeechPipeline whose TTS volume it changes lives there.
+ _call(surface, "set_on_speaker_toggle", lambda: emit("speaker_toggle"))
_call(
surface,
"set_feedback_publisher",
diff --git a/jarvis/ui/jarvisbar/null_overlay.py b/jarvis/ui/jarvisbar/null_overlay.py
index 9809f7a837..1c813d4e05 100644
--- a/jarvis/ui/jarvisbar/null_overlay.py
+++ b/jarvis/ui/jarvisbar/null_overlay.py
@@ -32,6 +32,7 @@ class NullOverlay:
def set_on_mute_toggle(self, callback: Callable[[], None] | None) -> None: ...
def set_feedback_publisher(self, callback: Callable[[str, dict], None] | None) -> None: ...
def set_on_show_window(self, callback: Callable[[], None] | None) -> None: ...
+ def set_on_speaker_toggle(self, callback: Callable[[], None] | None) -> None: ...
def start_in_thread(self, timeout: float = 3.0) -> None: ...
def stop(self) -> None: ...
def _on_reset_double_click(self, _event: Any = None) -> None: ...
diff --git a/jarvis/ui/jarvisbar/subprocess_overlay.py b/jarvis/ui/jarvisbar/subprocess_overlay.py
index 49f0a37a42..c2b6ecfe76 100644
--- a/jarvis/ui/jarvisbar/subprocess_overlay.py
+++ b/jarvis/ui/jarvisbar/subprocess_overlay.py
@@ -132,6 +132,7 @@ class SubprocessBarOverlay:
self._on_hangup: Callable[[], None] | None = None
self._feedback_publisher: Callable[[str, dict], None] | None = None
self._on_show_window: Callable[[], None] | None = None
+ self._on_speaker_toggle: Callable[[], None] | None = None
# ------------------------------------------------------------------ #
# Lifecycle #
@@ -327,6 +328,9 @@ class SubprocessBarOverlay:
def set_on_show_window(self, callback: Callable[[], None] | None) -> None:
self._on_show_window = callback
+ def set_on_speaker_toggle(self, callback: Callable[[], None] | None) -> None:
+ self._on_speaker_toggle = callback
+
def _on_reset_double_click(self, _event: Any = None) -> None:
self._send({"op": "reset_position"})
@@ -517,6 +521,8 @@ class SubprocessBarOverlay:
cb_show = self._on_show_window
if cb_show is not None:
cb_show()
+ elif event == "speaker_toggle":
+ self._dispatch_speaker_toggle()
elif event == "drop":
self._dispatch_drop_event(msg)
except Exception: # noqa: BLE001 — a bad callback must not kill the pump
@@ -550,6 +556,22 @@ class SubprocessBarOverlay:
"""Send a drop verdict down to the hosted bar (never raises)."""
self._send({"op": "drop_result", "accepted": bool(accepted)})
+ def _dispatch_speaker_toggle(self) -> None:
+ """Mute / unmute the assistant's voice, here in the parent.
+
+ The orb's speaker disc is drawn in the child, but the TTS volume it
+ changes belongs to the SpeechPipeline, which only ever exists in this
+ process. An explicitly installed callback wins for embedders and tests.
+ """
+ callback = self._on_speaker_toggle
+ if callback is not None:
+ callback()
+ return
+ from ui.orb.controls import toggle_speaker_mute
+
+ if toggle_speaker_mute() is None:
+ log.debug("orb speaker toggle had no live pipeline in the parent")
+
def _dispatch_talk_action(self) -> None:
"""Start a voice session in the parent process.
diff --git a/tests/unit/ui/test_orb_controls.py b/tests/unit/ui/test_orb_controls.py
new file mode 100644
index 0000000000..c6b2433448
--- /dev/null
+++ b/tests/unit/ui/test_orb_controls.py
@@ -0,0 +1,188 @@
+"""Guards for the voice orb's desktop control row (``ui.orb.controls``).
+
+The row exists because the desktop orb's capabilities used to be invisible
+gestures. These tests pin the three properties that make it usable rather than
+decorative: a click lands on the button the user aimed at, the disc says what
+the system is actually doing, and the speaker toggle changes the real volume
+without persisting a mute the user will not remember tomorrow.
+"""
+
+from __future__ import annotations
+
+import pytest
+
+from jarvis.core import runtime_refs
+from ui.orb import controls
+
+
+class _FakePipeline:
+ """Just enough SpeechPipeline for the speaker toggle."""
+
+ def __init__(self, volume: float = 0.8) -> None:
+ self.volume = volume
+ self.writes: list[float] = []
+
+ def get_tts_volume(self) -> float:
+ return self.volume
+
+ def set_tts_volume(self, volume: float) -> None:
+ self.volume = float(volume)
+ self.writes.append(float(volume))
+
+
+def live_pipeline() -> _FakePipeline:
+ pipeline = _FakePipeline()
+ runtime_refs.set_speech_pipeline(pipeline)
+ try:
+ yield pipeline
+ finally:
+ runtime_refs.set_speech_pipeline(None)
+
+
+# --- geometry ---------------------------------------------------------------
+
+
+def test_every_action_is_reachable_at_its_own_centre() -> None:
+ centre_y = controls.ROW_PADDING + controls.BUTTON_SIZE / 2
+ hits = [controls.hit_test(cx, centre_y) for cx in controls.button_centers()]
+ assert hits == list(controls.ACTIONS)
+
+
+def test_the_gaps_between_discs_resolve_to_nothing() -> None:
+ """A near-miss must not hang up the call. Same rule as the bar's close-X."""
+ centre_y = controls.ROW_PADDING + controls.BUTTON_SIZE / 2
+ first, second = controls.button_centers()[:2]
+ between = (first + second) / 2
+ assert controls.hit_test(between, centre_y) is None
+ # Above and below the discs is the window's padding, not a button.
+ assert controls.hit_test(first, 0.0) is None
+
+
+def test_row_is_wide_enough_for_every_disc_and_gap() -> None:
+ width, height = controls.row_size()
+ expected = (
+ len(controls.ACTIONS) * controls.BUTTON_SIZE
+ + (len(controls.ACTIONS) - 1) * controls.BUTTON_GAP
+ + 2 * controls.ROW_PADDING
+ )
+ assert width == expected
+ assert height == controls.BUTTON_SIZE + 2 * controls.ROW_PADDING
+
+
+# --- rendering --------------------------------------------------------------
+
+
+def test_corners_stay_pure_key_colour_so_the_window_is_transparent() -> None:
+ """A blended corner survives the colour key as a pink fleck (see the module)."""
+ key = (255, 0, 255)
+ frame = controls.render_row(controls.ControlState(), color_key=key)
+ width, height = frame.size
+ for point in ((0, 0), (width - 1, 0), (0, height - 1), (width - 1, height - 1)):
+ assert frame.getpixel(point) == key
+
+
+def test_disc_centres_are_painted_not_keyed_out() -> None:
+ key = (255, 0, 255)
+ frame = controls.render_row(controls.ControlState(), color_key=key)
+ centre_y = int(controls.ROW_PADDING + controls.BUTTON_SIZE / 2)
+ for cx in controls.button_centers():
+ assert frame.getpixel((int(cx), centre_y)) != key
+
+
+def test_a_live_conversation_lights_the_mic_disc() -> None:
+ """Idle and active must not look identical — that is the whole indicator."""
+ idle = controls.render_row(controls.ControlState())
+ live = controls.render_row(controls.ControlState(active=True))
+ mic_x = int(controls.button_centers()[controls.ACTIONS.index("mic")])
+ centre_y = int(controls.ROW_PADDING + controls.BUTTON_SIZE / 2)
+ box = (mic_x - 10, centre_y - 10, mic_x + 10, centre_y + 10)
+ assert idle.crop(box).tobytes() != live.crop(box).tobytes()
+ # The lit disc carries the product's gold, not just "some other pixels".
+ fill, _border, icon = controls._disc_colors("mic", controls.ControlState(active=True))
+ assert fill == controls.BTN_BG_ON
+ assert icon == controls.BTN_ICON_ON
+
+
+def test_a_muted_speaker_is_marked_in_the_destructive_colour() -> None:
+ fill, border, icon = controls._disc_colors(
+ "speaker", controls.ControlState(speaker_muted=True)
+ )
+ assert (fill, border, icon) == (
+ controls.BTN_BG_OFF,
+ controls.BTN_BORDER_OFF,
+ controls.BTN_ICON_OFF,
+ )
+
+
+def test_attach_is_dimmed_rather_than_hidden_when_unavailable() -> None:
+ """A control that vanishes teaches the user nothing about why."""
+ _fill, _border, icon = controls._disc_colors(
+ "attach", controls.ControlState(can_attach=False)
+ )
+ assert icon == controls.BTN_ICON_DISABLED
+
+
+def test_hover_only_repaints_the_disc_under_the_pointer() -> None:
+ plain = controls._disc_colors("close", controls.ControlState())
+ hovered = controls._disc_colors("close", controls.ControlState(hovered="close"))
+ neighbour = controls._disc_colors("attach", controls.ControlState(hovered="close"))
+ assert hovered != plain
+ assert neighbour == controls._disc_colors("attach", controls.ControlState())
+
+
+# --- the speaker toggle -----------------------------------------------------
+
+
+def test_speaker_toggle_is_a_no_op_without_a_live_pipeline() -> None:
+ """Report nothing happened rather than painting a mute that never landed."""
+ runtime_refs.set_speech_pipeline(None)
+ assert controls.toggle_speaker_mute() is None
+ assert controls.speaker_is_muted() is False
+
+
+def test_speaker_toggle_mutes_and_restores_the_previous_volume(
+ live_pipeline: _FakePipeline,
+) -> None:
+ live_pipeline.volume = 0.65
+
+ assert controls.toggle_speaker_mute() is True
+ assert live_pipeline.volume == 0.0
+ assert controls.speaker_is_muted() is True
+
+ assert controls.toggle_speaker_mute() is False
+ assert live_pipeline.volume == pytest.approx(0.65)
+ assert controls.speaker_is_muted() is False
+
+
+def test_speaker_toggle_never_writes_the_config(
+ live_pipeline: _FakePipeline, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Session-only by design: a forgotten mute must not survive a restart."""
+ from jarvis.core import config_writer
+
+ def _fail(*_args: object, **_kwargs: object) -> None:
+ raise AssertionError("the orb's speaker toggle persisted the mute")
+
+ monkeypatch.setattr(config_writer, "set_tts_volume", _fail)
+ controls.toggle_speaker_mute()
+ controls.toggle_speaker_mute()
+ assert live_pipeline.writes == [0.0, pytest.approx(0.8)]
+
+
+def test_a_pipeline_without_a_volume_getter_is_assumed_audible() -> None:
+ class _Mute:
+ def __init__(self) -> None:
+ self.volume: float | None = None
+
+ def set_tts_volume(self, volume: float) -> None:
+ self.volume = volume
+
+ pipeline = _Mute()
+ runtime_refs.set_speech_pipeline(pipeline)
+ try:
+ # No getter, no attribute → treat as audible, so the first click mutes.
+ assert controls.toggle_speaker_mute() is True
+ assert pipeline.volume == 0.0
+ finally:
+ runtime_refs.set_speech_pipeline(None)
diff --git a/tests/unit/ui/test_orb_style_surface_parity.py b/tests/unit/ui/test_orb_style_surface_parity.py
new file mode 100644
index 0000000000..f82024f2f1
--- /dev/null
+++ b/tests/unit/ui/test_orb_style_surface_parity.py
@@ -0,0 +1,143 @@
+"""The voice orb wears the app's surface; the mascot keeps its own.
+
+Reported 2026-08-06: on the desktop the procedural sphere spoke through the
+mascot's comic bubble — black body, thick yellow border, bold yellow text —
+which reads as a different program's window sitting on the same screen. The
+look now travels with the style, and the sphere additionally carries the same
+four controls its in-app twin has (``components/agentic/VoiceBubble.tsx``).
+
+These are pure-logic guards: no Tk root is created, because the overlay's own
+pytest guard refuses to put a real window on a developer's desktop.
+"""
+
+from __future__ import annotations
+
+import pytest
+
+from ui.orb import overlay
+
+# --- the bubble -------------------------------------------------------------
+
+
+def test_the_sphere_does_not_borrow_the_mascots_comic_bubble() -> None:
+ orb = overlay.bubble_theme_for_style("voice_orb")
+ mascot = overlay.bubble_theme_for_style("mascot")
+ assert orb != mascot
+ # The three things that made it look foreign next to the sphere.
+ assert orb.text.lower() != overlay.BUBBLE_TEXT_HEX.lower()
+ assert orb.border.lower() != overlay.BUBBLE_BORDER_HEX.lower()
+ assert orb.bold is False
+ assert orb.border_width < mascot.border_width
+
+
+def test_the_sphere_has_no_speech_tail() -> None:
+ """A tail points at a mouth. The sphere has none, and neither does the
+ in-app bubble this copies."""
+ assert overlay.bubble_theme_for_style("voice_orb").tail is False
+ assert overlay.bubble_theme_for_style("mascot").tail is True
+
+
+def test_the_ghost_keeps_its_bubble_exactly_as_it_was() -> None:
+ mascot = overlay.bubble_theme_for_style("mascot")
+ assert mascot.bg == overlay.BUBBLE_BG_HEX
+ assert mascot.border == overlay.BUBBLE_BORDER_HEX
+ assert mascot.text == overlay.BUBBLE_TEXT_HEX
+ assert mascot.bold is True
+
+
+def test_an_unknown_style_falls_back_to_the_mascot_bubble() -> None:
+ assert overlay.bubble_theme_for_style("something-new") is overlay.MASCOT_BUBBLE_THEME
+
+
+# --- the control row --------------------------------------------------------
+
+
+def test_only_the_sphere_wears_the_control_row() -> None:
+ """A row of discs under the cartoon ghost would read as a bolted-on toolbar."""
+ assert overlay.OrbOverlay(style="voice_orb")._controls_wanted() is True
+ assert overlay.OrbOverlay(style="mascot")._controls_wanted() is False
+
+
+def test_the_mic_disc_starts_a_conversation_when_there_is_none() -> None:
+ orb = overlay.OrbOverlay(style="voice_orb")
+ calls: list[str] = []
+ orb.set_on_talk(lambda: calls.append("talk"))
+ orb.set_on_hangup(lambda: calls.append("hangup"))
+
+ orb._on_control_action("mic")
+
+ assert calls == ["talk"]
+
+
+def test_the_mic_disc_hangs_up_a_running_conversation() -> None:
+ orb = overlay.OrbOverlay(style="voice_orb")
+ calls: list[str] = []
+ orb.set_on_talk(lambda: calls.append("talk"))
+ orb.set_on_hangup(lambda: calls.append("hangup"))
+ orb._mode = "speak"
+
+ orb._on_control_action("mic")
+
+ assert calls == ["hangup"]
+ # Local feedback immediately, rather than waiting for microphone teardown
+ # plus the EventBus round-trip.
+ assert orb._mode == "idle"
+
+
+def test_the_x_ends_the_conversation_before_putting_the_orb_away() -> None:
+ orb = overlay.OrbOverlay(style="voice_orb")
+ calls: list[str] = []
+ orb.set_on_hangup(lambda: calls.append("hangup"))
+ orb._mode = "listen"
+
+ orb._on_control_action("close")
+
+ assert calls == ["hangup"]
+ assert orb._mode == "idle"
+
+
+def test_the_x_on_an_idle_orb_hangs_up_nothing() -> None:
+ orb = overlay.OrbOverlay(style="voice_orb")
+ calls: list[str] = []
+ orb.set_on_hangup(lambda: calls.append("hangup"))
+
+ orb._on_control_action("close")
+
+ assert calls == []
+
+
+def test_the_speaker_disc_delegates_when_a_host_owns_the_pipeline() -> None:
+ """On macOS the orb runs in a companion process with no pipeline of its own."""
+ orb = overlay.OrbOverlay(style="voice_orb")
+ calls: list[str] = []
+ orb.set_on_speaker_toggle(lambda: calls.append("speaker"))
+
+ orb._on_control_action("speaker")
+ assert calls == ["speaker"]
+ assert orb._speaker_muted is True
+
+ orb._on_control_action("speaker")
+ assert calls == ["speaker", "speaker"]
+ assert orb._speaker_muted is False
+
+
+def test_the_speaker_disc_leaves_its_icon_alone_without_a_pipeline() -> None:
+ """No pipeline, no mute — the disc must not claim one happened."""
+ from jarvis.core import runtime_refs
+
+ runtime_refs.set_speech_pipeline(None)
+ orb = overlay.OrbOverlay(style="voice_orb")
+
+ orb._on_control_action("speaker")
+
+ assert orb._speaker_muted is False
+
+
[email protected]("action", ["attach", "mic", "close", "speaker"])
+def test_every_rendered_disc_has_a_handler(action: str) -> None:
+ """The row draws four discs; a drawn disc that does nothing is a dead button."""
+ assert action in overlay.orb_controls.ACTIONS
+ orb = overlay.OrbOverlay(style="voice_orb")
+ # No Tk root and no callbacks wired: every branch must survive that rather
+ # than raising into the Tk event loop.
+ orb._on_control_action(action)
diff --git a/ui/orb/controls.py b/ui/orb/controls.py
new file mode 100644
index 0000000000..9e85a2e52a
--- /dev/null
+++ b/ui/orb/controls.py
@@ -0,0 +1,476 @@
+"""The voice orb's control row — the desktop twin of the in-app bubble's buttons.
+
+``components/agentic/VoiceBubble.tsx`` puts four equal circles under the orb:
+attach a file, start/end the conversation, put the voice away, mute the
+assistant's voice. On the desktop those capabilities existed only as invisible
+gestures (double-double-click, right-click, drop-on-orb), which is the same as
+not existing. This module draws that row and routes its clicks, so the orb ON
+the desktop offers what the orb IN the window offers.
+
+Two constraints shape the implementation, and neither is cosmetic:
+
+* **Hard circular edges.** The overlay windows key out one exact colour
+ (magenta) to become transparent. A pixel that is a *blend* of button and key
+ colour survives as a pink fringe, so every disc is composed through a BINARY
+ mask — the antialiasing lives strictly inside the disc, where the glyph is.
+ Same rule as ``ui.orb.voice_orb``.
+* **Supersampled glyphs.** A 4 px stroke drawn directly at 28 px aliases into a
+ staircase. Glyphs are drawn at 4x on their own layer and downscaled with
+ LANCZOS, exactly as ``jarvis.ui.jarvisbar.renderer`` does for its mic.
+
+The palette is the app's dark theme (``frontend/src/index.css``) resolved
+against the opaque background the app composites onto, because Tk has no
+per-pixel alpha here: what the web calls ``bg-background/85`` is one flat
+colour on the desktop.
+"""
+
+from __future__ import annotations
+
+import logging
+import math
+import os
+import sys
+from collections.abc import Callable, Sequence
+from dataclasses import dataclass
+
+from PIL import Image, ImageDraw
+
+# --- Palette (the app's dark theme, flattened) ------------------------------
+#: Resting disc: ``bg-background/85`` over the desktop reads as a near-black
+#: pebble; solid here because a layered Tk window has no partial alpha.
+BTN_BG = (19, 19, 19)
+#: ``border-border/50``, opened up a little. In the app a ``shadow-lg`` does
+#: the separating; a colour-keyed window cannot cast one (a soft edge blends
+#: with the key and survives as a pink fringe), so the rim has to carry that
+#: job alone — measured against a black terminal, where the app's own value
+#: disappeared completely.
+BTN_BORDER = (52, 52, 52)
+#: ``text-muted-foreground``.
+BTN_ICON = (143, 143, 143)
+#: Hover: ``hover:bg-secondary hover:text-foreground``.
+BTN_BG_HOVER = (26, 26, 26)
+BTN_ICON_HOVER = (244, 244, 245)
+#: Engaged (a live conversation on the mic button): ``bg-primary/15``,
+#: ``border-primary/50``, ``text-primary``.
+BTN_BG_ON = (47, 41, 10)
+BTN_BORDER_ON = (133, 112, 10)
+BTN_ICON_ON = (255, 214, 10)
+#: Muted speaker: ``bg-destructive/10``, ``border-destructive/40``.
+BTN_BG_OFF = (33, 16, 16)
+BTN_BORDER_OFF = (102, 33, 33)
+BTN_ICON_OFF = (239, 68, 68)
+#: Unavailable action (``disabled:opacity-40``) — dimmed, never hidden: a
+#: control that vanishes teaches the user nothing about why.
+BTN_ICON_DISABLED = (74, 74, 74)
+
+#: One disc, in pixels. Matches the in-app row's ``h-8 w-8``.
+BUTTON_SIZE = 28
+#: Gap between discs (``gap-2``).
+BUTTON_GAP = 8
+#: Breathing room around the row, so a disc never touches the window edge.
+ROW_PADDING = 4
+#: Vertical distance from the orb's bottom edge to the row.
+ROW_GAP_FROM_ORB = 6
+#: Supersampling factor for every glyph.
+_SS = 4
+
+#: The row's actions, left to right — the in-app order (attach, mic, close,
+#: speaker). Kept as a tuple so the hit-test, the renderer and the caller's
+#: dispatch can never disagree about which disc is which.
+ACTIONS: tuple[str, ...] = ("attach", "mic", "close", "speaker")
+
+
+def row_size(count: int = len(ACTIONS)) -> tuple[int, int]:
+ """Pixel size of the window holding ``count`` discs."""
+ width = count * BUTTON_SIZE + max(0, count - 1) * BUTTON_GAP + 2 * ROW_PADDING
+ return width, BUTTON_SIZE + 2 * ROW_PADDING
+
+
+def button_centers(count: int = len(ACTIONS)) -> list[float]:
+ """Horizontal centre of each disc inside the row window."""
+ step = BUTTON_SIZE + BUTTON_GAP
+ first = ROW_PADDING + BUTTON_SIZE / 2.0
+ return [first + index * step for index in range(count)]
+
+
+def hit_test(x: float, y: float, count: int = len(ACTIONS)) -> str | None:
+ """Which action a click at ``(x, y)`` lands on, or ``None`` between discs.
+
+ The gaps deliberately resolve to nothing. Every one of these buttons does
+ something the user would rather not undo by a near-miss — hanging up is the
+ obvious one — so a click has to land ON a disc, the same rule the Jarvis
+ Bar applies to its close-X (``jarvis.ui.jarvisbar.interaction``).
+ """
+ radius = BUTTON_SIZE / 2.0
+ cy = ROW_PADDING + radius
+ for index, cx in enumerate(button_centers(count)):
+ if math.hypot(x - cx, y - cy) <= radius:
+ return ACTIONS[index] if index < len(ACTIONS) else None
+ return None
+
+
+@dataclass(frozen=True)
+class ControlState:
+ """Everything the row needs to know to paint itself truthfully."""
+
+ #: A conversation is running (``listen`` / ``think`` / ``speak``).
+ active: bool = False
+ #: The assistant's voice is muted for this session.
+ speaker_muted: bool = False
+ #: Which disc the pointer is over, if any.
+ hovered: str | None = None
+ #: Attaching needs somewhere to attach TO; without it the disc is dimmed.
+ can_attach: bool = True
+
+
+# --- Glyphs -----------------------------------------------------------------
+# Each takes the supersampled draw context, the disc centre and radius in
+# SUPERSAMPLED coordinates, the stroke colour and width. They draw line art
+# only: a filled glyph at this size reads as a blob.
+
+
+def _draw_paperclip(d: ImageDraw.ImageDraw, cx: float, cy: float, r: float, color, w: int) -> None:
+ """A paper clip, drawn upright; the caller tilts it.
+
+ Two nested loops: an outer capsule (down the left, round the bottom, up the
+ right, closed across the top) and an inner one that stops short — which is
+ exactly the wire path of a real clip, and the only version of this shape
+ that survives being 17 px wide.
+ """
+ outer = r * 0.40
+ inner = r * 0.17
+ top = cy - r * 0.86
+ bottom = cy + r * 0.86
+ inner_bottom = cy + r * 0.50
+ # Outer loop.
+ d.line([(cx - outer, top + outer), (cx - outer, bottom - outer)], fill=color, width=w)
+ d.arc(
+ [cx - outer, bottom - 2 * outer, cx + outer, bottom],
+ start=0,
+ end=180,
+ fill=color,
+ width=w,
+ )
+ d.line([(cx + outer, top + outer), (cx + outer, bottom - outer)], fill=color, width=w)
+ d.arc(
+ [cx - outer, top, cx + outer, top + 2 * outer],
+ start=180,
+ end=360,
+ fill=color,
+ width=w,
+ )
+ # Inner loop — shorter at the bottom, open at the top, where the wire ends.
+ d.line(
+ [(cx - inner, top + outer * 1.6), (cx - inner, inner_bottom - inner)],
+ fill=color,
+ width=w,
+ )
+ d.arc(
+ [cx - inner, inner_bottom - 2 * inner, cx + inner, inner_bottom],
+ start=0,
+ end=180,
+ fill=color,
+ width=w,
+ )
+ d.line(
+ [(cx + inner, top + outer * 0.4), (cx + inner, inner_bottom - inner)],
+ fill=color,
+ width=w,
+ )
+
+
+def _draw_mic(
+ d: ImageDraw.ImageDraw,
+ cx: float,
+ cy: float,
+ r: float,
+ color,
+ w: int,
+ *,
+ slashed: bool,
+) -> None:
+ """Outline microphone: capsule head, cradle bow, stand. Mirrors the bar's."""
+ head_w = r * 0.30
+ d.rounded_rectangle(
+ [cx - head_w, cy - r * 0.72, cx + head_w, cy + r * 0.06],
+ radius=head_w,
+ outline=color,
+ width=w,
+ )
+ bow = r * 0.55
+ d.arc(
+ [cx - bow, cy - r * 0.40, cx + bow, cy + r * 0.48],
+ start=15,
+ end=165,
+ fill=color,
+ width=w,
+ )
+ d.line([(cx, cy + r * 0.44), (cx, cy + r * 0.74)], fill=color, width=w)
+ foot = r * 0.30
+ d.line([(cx - foot, cy + r * 0.74), (cx + foot, cy + r * 0.74)], fill=color, width=w)
+ if slashed:
+ s = r * 0.72
+ d.line([(cx - s, cy + s), (cx + s, cy - s)], fill=color, width=w)
+
+
+def _draw_close(d: ImageDraw.ImageDraw, cx: float, cy: float, r: float, color, w: int) -> None:
+ s = r * 0.56
+ d.line([(cx - s, cy - s), (cx + s, cy + s)], fill=color, width=w)
+ d.line([(cx - s, cy + s), (cx + s, cy - s)], fill=color, width=w)
+
+
+def _draw_speaker(
+ d: ImageDraw.ImageDraw,
+ cx: float,
+ cy: float,
+ r: float,
+ color,
+ w: int,
+ *,
+ muted: bool,
+) -> None:
+ """Speaker cone plus either two sound arcs or the mute cross."""
+ left = cx - r * 0.62
+ throat = cx - r * 0.18
+ body = r * 0.26
+ mouth = r * 0.52
+ d.polygon(
+ [
+ (left, cy - body),
+ (throat, cy - body),
+ (throat + r * 0.34, cy - mouth),
+ (throat + r * 0.34, cy + mouth),
+ (throat, cy + body),
+ (left, cy + body),
+ ],
+ outline=color,
+ width=w,
+ )
+ if muted:
+ s = r * 0.26
+ mx = cx + r * 0.50
+ d.line([(mx - s, cy - s), (mx + s, cy + s)], fill=color, width=w)
+ d.line([(mx - s, cy + s), (mx + s, cy - s)], fill=color, width=w)
+ return
+ for scale in (0.32, 0.60):
+ span = r * scale
+ d.arc(
+ [cx + r * 0.24 - span, cy - span, cx + r * 0.24 + span, cy + span],
+ start=-55,
+ end=55,
+ fill=color,
+ width=w,
+ )
+
+
+_Rgb = tuple[int, int, int]
+
+
+def _disc_colors(action: str, state: ControlState) -> tuple[_Rgb, _Rgb, _Rgb]:
+ """(fill, border, icon) for one disc in the given state."""
+ hovered = state.hovered == action
+ if action == "mic" and state.active:
+ return BTN_BG_ON, BTN_BORDER_ON, BTN_ICON_ON
+ if action == "speaker" and state.speaker_muted:
+ return BTN_BG_OFF, BTN_BORDER_OFF, BTN_ICON_OFF
+ if action == "attach" and not state.can_attach:
+ return BTN_BG, BTN_BORDER, BTN_ICON_DISABLED
+ if hovered:
+ icon = BTN_ICON_OFF if action == "close" else BTN_ICON_HOVER
+ return BTN_BG_HOVER, BTN_BORDER, icon
+ return BTN_BG, BTN_BORDER, BTN_ICON
+
+
+def _binary_disc_mask(diameter: int) -> Image.Image:
+ """Aliased disc mask. Binary on purpose — see the module docstring."""
+ mask = Image.new("L", (diameter, diameter), 0)
+ ImageDraw.Draw(mask).ellipse([0, 0, diameter - 1, diameter - 1], fill=255)
+ return mask
+
+
+_MASK_CACHE: dict[int, Image.Image] = {}
+
+
+def _disc_mask(diameter: int) -> Image.Image:
+ mask = _MASK_CACHE.get(diameter)
+ if mask is None:
+ mask = _binary_disc_mask(diameter)
+ _MASK_CACHE[diameter] = mask
+ return mask
+
+
+#: How far the clip leans. A paper clip drawn bolt upright reads as a safety
+#: pin; the tilt is what makes it recognisable at this size.
+_CLIP_TILT_DEG = 35.0
+
+
+def _render_disc(action: str, state: ControlState) -> Image.Image:
+ """One disc as an opaque square; the caller applies the circular mask."""
+ fill, border, icon = _disc_colors(action, state)
+ size = BUTTON_SIZE * _SS
+ layer = Image.new("RGB", (size, size), fill)
+ d = ImageDraw.Draw(layer)
+ stroke = max(1, round(1.0 * _SS))
+ inset = stroke
+ d.ellipse(
+ [inset, inset, size - 1 - inset, size - 1 - inset],
+ outline=border,
+ width=stroke,
+ )
+ centre = size / 2.0
+ radius = size * 0.30
+ glyph_w = max(1, round(1.35 * _SS))
+
+ # The glyph goes on its own transparent layer so it can be rotated before
+ # it meets the disc. Drawing straight onto the disc would make a tilted
+ # glyph impossible without tilting the disc with it.
+ glyph = Image.new("RGBA", (size, size), (0, 0, 0, 0))
+ gd = ImageDraw.Draw(glyph)
+ colour = (*icon, 255)
+ if action == "attach":
+ _draw_paperclip(gd, centre, centre, radius, colour, glyph_w)
+ glyph = glyph.rotate(
+ _CLIP_TILT_DEG, resample=Image.Resampling.BICUBIC, center=(centre, centre)
+ )
+ elif action == "mic":
+ # The in-app bubble shows a live mic while a conversation runs and a
+ # slashed one at rest, because the button STARTS the conversation. The
+ # desktop row says the same thing with the same glyph.
+ _draw_mic(gd, centre, centre, radius, colour, glyph_w, slashed=not state.active)
+ elif action == "close":
+ _draw_close(gd, centre, centre, radius, colour, glyph_w)
+ else:
+ _draw_speaker(gd, centre, centre, radius, colour, glyph_w, muted=state.speaker_muted)
+ layer.paste(glyph, (0, 0), glyph)
+ return layer.resize((BUTTON_SIZE, BUTTON_SIZE), Image.Resampling.LANCZOS)
+
+
+def render_row(
+ state: ControlState,
+ *,
+ color_key: tuple[int, int, int] = (255, 0, 255),
+ actions: Sequence[str] = ACTIONS,
+) -> Image.Image:
+ """The whole row as a colour-keyed RGB frame, ready for a layered window."""
+ width, height = row_size(len(actions))
+ frame = Image.new("RGB", (width, height), color_key)
+ mask = _disc_mask(BUTTON_SIZE)
+ top = ROW_PADDING
+ for action, cx in zip(actions, button_centers(len(actions)), strict=False):
+ disc = _render_disc(action, state)
+ frame.paste(disc, (int(round(cx - BUTTON_SIZE / 2.0)), top), mask)
+ return frame
+
+
+def toggle_speaker_mute() -> bool | None:
+ """Mute / unmute the assistant's voice for this session. Returns the new state.
+
+ Session-only by design, exactly like the in-app speaker button: a mute the
+ user forgot about must not survive a restart and leave Jarvis mysteriously
+ silent tomorrow. Nothing is written to ``jarvis.toml``.
+
+ Returns ``None`` when there is no live pipeline to talk to (a headless or
+ still-booting host), so the caller can leave the icon alone instead of
+ lying about a mute that never happened.
+ """
+ try:
+ from jarvis.core.runtime_refs import get_speech_pipeline
+ except Exception: # noqa: BLE001 — importable everywhere in practice
+ return None
+ pipeline = get_speech_pipeline()
+ if pipeline is None:
+ return None
+ setter = getattr(pipeline, "set_tts_volume", None)
+ if not callable(setter):
+ return None
+ current = _current_tts_volume(pipeline)
+ if current > 0.0:
+ _remember_volume(pipeline, current)
+ setter(0.0)
+ return True
+ setter(_remembered_volume(pipeline))
+ return False
+
+
+#: Where the pre-mute volume is parked, keyed per pipeline instance so a
+#: restarted pipeline cannot inherit a stale value.
+_PRE_MUTE_VOLUME: dict[int, float] = {}
+
+
+def _current_tts_volume(pipeline: object) -> float:
+ getter = getattr(pipeline, "get_tts_volume", None)
+ if callable(getter):
+ try:
+ return max(0.0, min(1.0, float(getter())))
+ except Exception: # noqa: BLE001 — a refusing getter is not a failure
+ logging.getLogger("jarvis.orb").debug(
+ "pipeline.get_tts_volume raised; probing the attribute instead",
+ exc_info=True,
+ )
+ for attribute in ("_tts_volume", "tts_volume"):
+ value = getattr(pipeline, attribute, None)
+ if isinstance(value, int | float):
+ return max(0.0, min(1.0, float(value)))
+ # Unknown volume — treat as audible, same assumption the in-app button
+ # makes when its GET fails. The first click then simply mutes.
+ return 1.0
+
+
+def _remember_volume(pipeline: object, volume: float) -> None:
+ _PRE_MUTE_VOLUME[id(pipeline)] = volume
+
+
+def _remembered_volume(pipeline: object) -> float:
+ return _PRE_MUTE_VOLUME.get(id(pipeline), 1.0)
+
+
+def speaker_is_muted() -> bool:
+ """Best-effort read of "the assistant's voice is currently silenced"."""
+ try:
+ from jarvis.core.runtime_refs import get_speech_pipeline
+ except Exception: # noqa: BLE001
+ return False
+ pipeline = get_speech_pipeline()
+ if pipeline is None:
+ return False
+ return _current_tts_volume(pipeline) <= 0.0
+
+
+def pick_and_dispatch_files(parent: object, on_error: Callable[[str], None] | None = None) -> int:
+ """Open a file chooser and hand the picks to the conversation.
+
+ Same destination as dropping a file onto the orb — ``drop_bridge`` — so the
+ macOS companion process needs no new IPC of its own: its drop forwarding
+ already carries this to the parent where the brain lives.
+
+ Returns the number of files handed over (0 when the user cancelled).
+ """
+ # Same guard as ``OrbOverlay.start``: a modal file chooser opened by a test
+ # run blocks the whole suite until somebody notices and closes it by hand.
+ # Dead code in the live app — pytest is never imported there.
+ if "pytest" in sys.modules and not os.environ.get("JARVIS_GUI_TESTS"):
+ return 0
+ try:
+ from tkinter import filedialog
+ except Exception as exc: # noqa: BLE001 — no Tk, no dialog
+ if on_error is not None:
+ on_error(f"file dialog unavailable: {exc}")
+ return 0
+ try:
+ picked = filedialog.askopenfilenames(parent=parent, title="Attach to the conversation")
+ except Exception as exc: # noqa: BLE001 — a cancelled/broken dialog is not fatal
+ if on_error is not None:
+ on_error(f"file dialog failed: {exc}")
+ return 0
+ paths = [str(path) for path in (picked or ()) if str(path).strip()]
+ if not paths:
+ return 0
+ try:
+ from jarvis.overlay.drop_bridge import dispatch_drop
+
+ dispatch_drop(paths, "")
+ except Exception as exc: # noqa: BLE001
+ if on_error is not None:
+ on_error(f"attach dispatch failed: {exc}")
+ return 0
+ return len(paths)
diff --git a/ui/orb/overlay.py b/ui/orb/overlay.py
index 6049cb672f..734a491c54 100644
--- a/ui/orb/overlay.py
+++ b/ui/orb/overlay.py
@@ -47,6 +47,7 @@ Standalone test:
from __future__ import annotations
import argparse
+import logging
import math
import os
import queue
@@ -67,6 +68,7 @@ from jarvis.core.config import DEFAULT_CONFIG_FILE as JARVIS_TOML_PATH
from jarvis.core.win32_dpi import ensure_dpi_awareness as _ensure_dpi_awareness
from jarvis.ui.jarvisbar.modes import MODES
from jarvis.ui.overlay_styles import LEGACY_STYLE_ALIASES, ORB_STYLES
+from ui.orb import controls as orb_controls
from ui.orb.animations import (
ANIMATION_REGISTRY,
Animation,
@@ -165,6 +167,64 @@ TRANSCRIPT_MAX_VISIBLE_LINES = 4
# Min on-screen time so fast LISTENING→THINKING bounces are still readable.
BUBBLE_MIN_SHOW_S = 1.1
+
+@dataclass(frozen=True)
+class BubbleTheme:
+ """How the speech bubble is painted for one orb style.
+
+ The bubble used to be the mascot's bubble, full stop: black body, thick
+ yellow border, bold yellow text — the comic look that belongs to the Gigi
+ ghost. Beside the procedural sphere that reads as a different program's
+ window sitting on the same desktop, which is exactly what the maintainer
+ reported (2026-08-06). So the look travels with the style instead of being
+ baked into the widget: the ghost keeps its bubble, the orb gets the app's
+ own quiet surface (``bg-background/85`` + ``border-border/50`` +
+ ``text-muted-foreground``, flattened — a layered Tk window has no partial
+ alpha), and neither one has to compromise for the other.
+ """
+
+ bg: str
+ border: str
+ text: str
+ border_width: int
+ #: Bold is the mascot's voice. The orb's transcript is read, not shouted.
+ bold: bool
+ #: A tail points at a character that is speaking. The orb is not a mouth,
+ #: and the in-app bubble it copies has no tail either.
+ tail: bool
+ corner_radius: int
+
+
+#: The Gigi bubble, unchanged — the ghost's own voice.
+MASCOT_BUBBLE_THEME = BubbleTheme(
+ bg=BUBBLE_BG_HEX,
+ border=BUBBLE_BORDER_HEX,
+ text=BUBBLE_TEXT_HEX,
+ border_width=BUBBLE_BORDER_WIDTH,
+ bold=True,
+ tail=True,
+ corner_radius=BUBBLE_CORNER_RADIUS,
+)
+
+#: The app's surface, so the desktop orb and the in-app orb read as one thing.
+#: The border is a shade above the app's ``--border``: in the app a shadow
+#: separates the bubble from what is behind it, and a colour-keyed window
+#: cannot cast one without fringing.
+ORB_BUBBLE_THEME = BubbleTheme(
+ bg="#121212",
+ border="#333333",
+ text="#B4B4B4",
+ border_width=1,
+ bold=False,
+ tail=False,
+ corner_radius=16,
+)
+
+
+def bubble_theme_for_style(style: str) -> BubbleTheme:
+ """The bubble look one orb style wears."""
+ return ORB_BUBBLE_THEME if style == "voice_orb" else MASCOT_BUBBLE_THEME
+
# Magenta color key — Tkinter renders this color pixel-perfect transparent
COLOR_KEY_HEX = "#FF00FF"
COLOR_KEY_RGB = np.array([255, 0, 255], dtype=np.uint8)
@@ -1062,12 +1122,21 @@ class OrbCommentBubble:
LWA_COLORKEY transparency as the main orb.
"""
- def __init__(self, parent: tk.Tk, orb_x: int, orb_y: int, orb_w: int, screen_w: int) -> None:
+ def __init__(
+ self,
+ parent: tk.Tk,
+ orb_x: int,
+ orb_y: int,
+ orb_w: int,
+ screen_w: int,
+ theme: BubbleTheme = MASCOT_BUBBLE_THEME,
+ ) -> None:
self._parent = parent
self._orb_x = orb_x
self._orb_y = orb_y
self._orb_w = orb_w
self._screen_w = screen_w
+ self._theme = theme
self._top: tk.Toplevel | None = None
self._canvas: tk.Canvas | None = None
self._dismiss_after_id: str | None = None
@@ -1135,19 +1204,39 @@ class OrbCommentBubble:
# the mascot root; relying on tkinter's process-global default root
# would create the fonts in the wrong interpreter and make the bubble
# fail as soon as it tries to draw text.
+ weight = "bold" if self._theme.bold else "normal"
self._font = tkfont.Font(
root=top,
family=BUBBLE_FONT_FAMILY,
size=BUBBLE_FONT_SIZE,
- weight="bold",
+ weight=weight,
)
self._transcript_font = tkfont.Font(
root=top,
family=BUBBLE_FONT_FAMILY,
size=TRANSCRIPT_BUBBLE_FONT_SIZE,
- weight="bold",
+ weight=weight,
)
+ def set_theme(self, theme: BubbleTheme) -> None:
+ """Repaint in another style's colours from the next show() onwards.
+
+ Called on a live style swap (mascot <-> voice orb). The bubble on
+ screen right now is hidden rather than converted: a half-second of the
+ old colours is nothing, a half-drawn bubble is a bug.
+ """
+ if theme == self._theme:
+ return
+ self._theme = theme
+ weight = "bold" if theme.bold else "normal"
+ for font in (self._font, self._transcript_font):
+ if font is not None:
+ try:
+ font.configure(weight=weight)
+ except tk.TclError:
+ pass
+ self.hide()
+
def show(
self,
text: str,
@@ -1181,6 +1270,7 @@ class OrbCommentBubble:
pass
self._dismiss_after_id = None
+ theme = self._theme
# Probe text size by creating a throwaway text item and reading bbox.
probe_id = self._canvas.create_text(
0,
@@ -1189,7 +1279,7 @@ class OrbCommentBubble:
font=self._font,
anchor="nw",
width=BUBBLE_MAX_WIDTH,
- fill=BUBBLE_TEXT_HEX,
+ fill=theme.text,
)
bbox = self._canvas.bbox(probe_id)
self._canvas.delete(probe_id)
@@ -1199,7 +1289,8 @@ class OrbCommentBubble:
text_h = bbox[3] - bbox[1]
bubble_w = text_w + 2 * BUBBLE_PADDING_X
body_h = text_h + 2 * BUBBLE_PADDING_Y
- total_h = body_h + BUBBLE_TAIL_H
+ tail_h = BUBBLE_TAIL_H if theme.tail else 0
+ total_h = body_h + tail_h
bubble_x = self._orb_x + self._orb_w // 2 - bubble_w // 2
bubble_x = max(8, min(bubble_x, self._screen_w - bubble_w - 8))
@@ -1225,36 +1316,37 @@ class OrbCommentBubble:
1,
bubble_w - 1,
body_h - 1,
- BUBBLE_CORNER_RADIUS,
- fill=BUBBLE_BG_HEX,
- outline=BUBBLE_BORDER_HEX,
- width=BUBBLE_BORDER_WIDTH,
+ theme.corner_radius,
+ fill=theme.bg,
+ outline=theme.border,
+ width=theme.border_width,
)
- tail_base_y = body_h - 1
- tail_points = [
- tail_tip_x - tail_half,
- tail_base_y,
- tail_tip_x + tail_half,
- tail_base_y,
- tail_tip_x,
- tail_base_y + BUBBLE_TAIL_H,
- ]
- self._canvas.create_polygon(
- tail_points,
- fill=BUBBLE_BG_HEX,
- outline=BUBBLE_BORDER_HEX,
- width=BUBBLE_BORDER_WIDTH,
- )
- # Hide the seam between body bottom and tail base.
- self._canvas.create_line(
- tail_tip_x - tail_half + 1,
- tail_base_y,
- tail_tip_x + tail_half - 1,
- tail_base_y,
- fill=BUBBLE_BG_HEX,
- width=BUBBLE_BORDER_WIDTH + 1,
- )
+ if theme.tail:
+ tail_base_y = body_h - 1
+ tail_points = [
+ tail_tip_x - tail_half,
+ tail_base_y,
+ tail_tip_x + tail_half,
+ tail_base_y,
+ tail_tip_x,
+ tail_base_y + BUBBLE_TAIL_H,
+ ]
+ self._canvas.create_polygon(
+ tail_points,
+ fill=theme.bg,
+ outline=theme.border,
+ width=theme.border_width,
+ )
+ # Hide the seam between body bottom and tail base.
+ self._canvas.create_line(
+ tail_tip_x - tail_half + 1,
+ tail_base_y,
+ tail_tip_x + tail_half - 1,
+ tail_base_y,
+ fill=theme.bg,
+ width=theme.border_width + 1,
+ )
self._canvas.create_text(
BUBBLE_PADDING_X,
@@ -1263,7 +1355,7 @@ class OrbCommentBubble:
font=self._font,
anchor="nw",
width=BUBBLE_MAX_WIDTH,
- fill=BUBBLE_TEXT_HEX,
+ fill=theme.text,
)
self._top.deiconify()
@@ -1293,6 +1385,7 @@ class OrbCommentBubble:
self._queue_after_id = None
self._queued_text = None
+ theme = self._theme
display_text = text.strip() or "..."
bubble_w = min(TRANSCRIPT_BUBBLE_WIDTH, max(220, self._screen_w - 16))
text_width = min(
@@ -1307,17 +1400,23 @@ class OrbCommentBubble:
font=self._transcript_font,
anchor="nw",
width=text_width,
- fill=BUBBLE_TEXT_HEX,
+ fill=theme.text,
)
bbox = self._canvas.bbox(probe_id)
self._canvas.delete(probe_id)
text_h = line_height if bbox is None else max(line_height, bbox[3] - bbox[1])
visible_lines = _transcript_visible_line_count(text_h, line_height)
body_h = _transcript_body_height(visible_lines, line_height)
- total_h = body_h + BUBBLE_TAIL_H
+ tail_h = BUBBLE_TAIL_H if theme.tail else 0
+ total_h = body_h + tail_h
mascot_center_x = self._orb_x + self._orb_w // 2
- bubble_x = mascot_center_x - bubble_w + 30
+ # With a tail the bubble hangs off to one side so the pointer can aim at
+ # the mascot's head; without one there is nothing to aim, and anything
+ # but centred reads as a misplaced window.
+ bubble_x = (
+ mascot_center_x - bubble_w + 30 if theme.tail else mascot_center_x - bubble_w // 2
+ )
bubble_x = max(8, min(bubble_x, self._screen_w - bubble_w - 8))
bubble_y = max(8, self._orb_y - total_h - BUBBLE_GAP_FROM_ORB)
@@ -1339,35 +1438,36 @@ class OrbCommentBubble:
1,
bubble_w - 1,
body_h - 1,
- BUBBLE_CORNER_RADIUS,
- fill=BUBBLE_BG_HEX,
- outline=BUBBLE_BORDER_HEX,
- width=BUBBLE_BORDER_WIDTH,
+ theme.corner_radius,
+ fill=theme.bg,
+ outline=theme.border,
+ width=theme.border_width,
)
- tail_base_y = body_h - 1
- tail_points = [
- tail_tip_x - tail_half,
- tail_base_y,
- tail_tip_x + tail_half,
- tail_base_y,
- tail_tip_x,
- tail_base_y + BUBBLE_TAIL_H,
- ]
- self._canvas.create_polygon(
- tail_points,
- fill=BUBBLE_BG_HEX,
- outline=BUBBLE_BORDER_HEX,
- width=BUBBLE_BORDER_WIDTH,
- )
- self._canvas.create_line(
- tail_tip_x - tail_half + 1,
- tail_base_y,
- tail_tip_x + tail_half - 1,
- tail_base_y,
- fill=BUBBLE_BG_HEX,
- width=BUBBLE_BORDER_WIDTH + 1,
- )
+ if theme.tail:
+ tail_base_y = body_h - 1
+ tail_points = [
+ tail_tip_x - tail_half,
+ tail_base_y,
+ tail_tip_x + tail_half,
+ tail_base_y,
+ tail_tip_x,
+ tail_base_y + BUBBLE_TAIL_H,
+ ]
+ self._canvas.create_polygon(
+ tail_points,
+ fill=theme.bg,
+ outline=theme.border,
+ width=theme.border_width,
+ )
+ self._canvas.create_line(
+ tail_tip_x - tail_half + 1,
+ tail_base_y,
+ tail_tip_x + tail_half - 1,
+ tail_base_y,
+ fill=theme.bg,
+ width=theme.border_width + 1,
+ )
self._canvas.create_text(
BUBBLE_PADDING_X,
@@ -1376,7 +1476,7 @@ class OrbCommentBubble:
font=self._transcript_font,
anchor="sw",
width=text_width,
- fill=BUBBLE_TEXT_HEX,
+ fill=theme.text,
)
self._top.deiconify()
@@ -1466,6 +1566,301 @@ class OrbCommentBubble:
return self._canvas.create_polygon(points, smooth=True, **kwargs)
+class OrbControlRow:
+ """The four round controls under the voice orb — see :mod:`ui.orb.controls`.
+
+ Its own frameless, always-on-top Toplevel rather than extra pixels on the
+ orb's window, for three reasons that all point the same way: the orb window
+ is exactly the sphere (a taller window would put an invisible click-eating
+ rectangle over whatever is underneath), the row has to appear and disappear
+ on its own schedule, and the orb's frame loop must not repaint four static
+ discs sixty times a second.
+
+ Visibility is deliberately conditional (maintainer decision 2026-08-06): at
+ rest the desktop shows a sphere and nothing else. The row arrives when the
+ pointer does, or when a conversation is running — the two moments where a
+ control is something the user is reaching for rather than clutter they did
+ not ask for.
+ """
+
+ #: Grace period between losing the pointer and hiding, in ms. The row is a
+ #: separate window a few pixels below the orb, so travelling from one to
+ #: the other means genuinely leaving both — without this the row would
+ #: vanish under the pointer on its way to being clicked.
+ HOVER_GRACE_MS = 260
+
+ #: After a hang-up, ignore clicks for this long. Same guard as the Jarvis
+ #: Bar's close-X: the optimistic state flip must not let a second click
+ #: land as "start a new session" (the request_hangup storm, 2026-06-19).
+ CLICK_GUARD_S = 0.6
+
+ def __init__(self, parent: tk.Tk, orb_x: int, orb_y: int, orb_w: int, orb_h: int) -> None:
+ self._parent = parent
+ self._orb_x = orb_x
+ self._orb_y = orb_y
+ self._orb_w = orb_w
+ self._orb_h = orb_h
+ self._top: tk.Toplevel | None = None
+ self._canvas: tk.Canvas | None = None
+ self._photo: ImageTk.PhotoImage | None = None
+ self._image_id: int | None = None
+ self._state = orb_controls.ControlState()
+ self._visible = False
+ self._pointer_inside = False
+ self._hide_after_id: str | None = None
+ self._pressed_action: str | None = None
+ self._click_block_until = 0.0
+ self._on_action: Callable[[str], None] | None = None
+ self._width, self._height = orb_controls.row_size()
+ self._build()
+
+ # -- wiring ---------------------------------------------------------
+
+ def set_on_action(self, callback: Callable[[str], None] | None) -> None:
+ """Route a resolved button press ("attach"/"mic"/"close"/"speaker")."""
+ self._on_action = callback
+
+ def _build(self) -> None:
+ top = tk.Toplevel(self._parent)
+ top.overrideredirect(True)
+ top.wm_attributes("-topmost", True)
+ self._mac_transparent = False
+ if sys.platform == "darwin":
+ try:
+ top.wm_attributes("-transparent", True)
+ top.configure(bg="systemTransparent")
+ self._mac_transparent = True
+ except tk.TclError:
+ logging.getLogger("jarvis.orb").warning(
+ "macOS -transparent unsupported — the orb controls render opaque"
+ )
+ top.configure(bg=COLOR_KEY_HEX)
+ else:
+ top.wm_attributes("-transparentcolor", COLOR_KEY_HEX)
+ top.configure(bg=COLOR_KEY_HEX)
+ _hide_tk_window_from_task_switcher(top)
+ top.withdraw()
+
+ canvas = tk.Canvas(
+ top,
+ width=self._width,
+ height=self._height,
+ bg="systemTransparent" if self._mac_transparent else COLOR_KEY_HEX,
+ highlightthickness=0,
+ borderwidth=0,
+ )
+ canvas.pack(fill="both", expand=True)
+ if self._mac_transparent:
+ top.update_idletasks()
+ apply_macos_clear_backing()
+
+ canvas.bind("<Motion>", self._on_motion)
+ canvas.bind("<Enter>", self._on_enter)
+ canvas.bind("<Leave>", self._on_leave)
+ canvas.bind("<ButtonPress-1>", self._on_press)
+ canvas.bind("<ButtonRelease-1>", self._on_release)
+
+ self._top = top
+ self._canvas = canvas
+ self._repaint()
+
+ # -- geometry -------------------------------------------------------
+
+ def update_anchor(self, orb_x: int, orb_y: int) -> None:
+ """Follow the orb after a drag / monitor change."""
+ self._orb_x = orb_x
+ self._orb_y = orb_y
+ if self._visible:
+ self._place()
+
+ def _place(self) -> None:
+ if self._top is None:
+ return
+ x = self._orb_x + self._orb_w // 2 - self._width // 2
+ y = self._orb_y + self._orb_h + orb_controls.ROW_GAP_FROM_ORB
+ try:
+ self._top.geometry(f"{self._width}x{self._height}+{x}+{y}")
+ except tk.TclError:
+ pass
+
+ # -- state ----------------------------------------------------------
+
+ def set_state(
+ self,
+ *,
+ active: bool | None = None,
+ speaker_muted: bool | None = None,
+ can_attach: bool | None = None,
+ ) -> None:
+ """Update what the discs say, repainting only on a real change."""
+ state = orb_controls.ControlState(
+ active=self._state.active if active is None else bool(active),
+ speaker_muted=(
+ self._state.speaker_muted if speaker_muted is None else bool(speaker_muted)
+ ),
+ hovered=self._state.hovered,
+ can_attach=self._state.can_attach if can_attach is None else bool(can_attach),
+ )
+ if state == self._state:
+ return
+ self._state = state
+ self._repaint()
+
+ def _repaint(self) -> None:
+ if self._canvas is None:
+ return
+ try:
+ frame = orb_controls.render_row(self._state, color_key=tuple(COLOR_KEY_RGB.tolist()))
+ image = key_to_alpha(frame) if self._mac_transparent else frame
+ self._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)
+ else:
+ self._canvas.itemconfigure(self._image_id, image=self._photo)
+ except tk.TclError:
+ pass
+
+ # -- visibility -----------------------------------------------------
+
+ def show(self) -> None:
+ if self._top is None or self._visible:
+ return
+ self._cancel_pending_hide()
+ self._place()
+ try:
+ self._top.deiconify()
+ if self._mac_transparent:
+ apply_macos_clear_backing()
+ self._top.lift()
+ except tk.TclError:
+ return
+ self._visible = True
+
+ def hide(self) -> None:
+ self._cancel_pending_hide()
+ self._pointer_inside = False
+ if self._state.hovered is not None:
+ self._state = orb_controls.ControlState(
+ active=self._state.active,
+ speaker_muted=self._state.speaker_muted,
+ hovered=None,
+ can_attach=self._state.can_attach,
+ )
+ self._repaint()
+ if self._top is None or not self._visible:
+ return
+ try:
+ self._top.withdraw()
+ except tk.TclError:
+ pass
+ self._visible = False
+
+ def hide_after_grace(self) -> None:
+ """Hide unless the pointer comes back within :attr:`HOVER_GRACE_MS`."""
+ if self._top is None or not self._visible:
+ return
+ self._cancel_pending_hide()
+ try:
+ self._hide_after_id = self._top.after(self.HOVER_GRACE_MS, self._grace_elapsed)
+ except tk.TclError:
+ self.hide()
+
+ def _grace_elapsed(self) -> None:
+ self._hide_after_id = None
+ if self._pointer_inside:
+ return
+ self.hide()
+
+ def _cancel_pending_hide(self) -> None:
+ if self._hide_after_id is None or self._top is None:
+ self._hide_after_id = None
+ return
+ try:
+ self._top.after_cancel(self._hide_after_id)
+ except tk.TclError:
+ pass
+ self._hide_after_id = None
+
+ @property
+ def pointer_inside(self) -> bool:
+ return self._pointer_inside
+
+ @property
+ def visible(self) -> bool:
+ return self._visible
+
+ def destroy(self) -> None:
+ self._cancel_pending_hide()
+ top = self._top
+ self._top = None
+ self._canvas = None
+ self._photo = None
+ if top is None:
+ return
+ try:
+ top.destroy()
+ except tk.TclError:
+ pass
+
+ # -- pointer --------------------------------------------------------
+
+ def _on_enter(self, event: tk.Event) -> None:
+ self._pointer_inside = True
+ self._cancel_pending_hide()
+ self._on_motion(event)
+
+ def _on_leave(self, _event: tk.Event) -> None:
+ self._pointer_inside = False
+ self._set_hovered(None)
+ self.hide_after_grace()
+
+ def _on_motion(self, event: tk.Event) -> None:
+ self._set_hovered(orb_controls.hit_test(event.x, event.y))
+
+ def _set_hovered(self, action: str | None) -> None:
+ if action == self._state.hovered:
+ return
+ self._state = orb_controls.ControlState(
+ active=self._state.active,
+ speaker_muted=self._state.speaker_muted,
+ hovered=action,
+ can_attach=self._state.can_attach,
+ )
+ self._repaint()
+ if self._canvas is not None:
+ try:
+ self._canvas.configure(cursor="hand2" if action else "")
+ except tk.TclError:
+ pass
+
+ def _on_press(self, event: tk.Event) -> None:
+ self._pressed_action = orb_controls.hit_test(event.x, event.y)
+
+ def _on_release(self, event: tk.Event) -> None:
+ pressed = self._pressed_action
+ self._pressed_action = None
+ if pressed is None:
+ return
+ # Press and release must agree: a pointer that slid off the disc did
+ # not click it, and every action here is one the user would rather not
+ # trigger by accident.
+ if orb_controls.hit_test(event.x, event.y) != pressed:
+ return
+ if time.monotonic() < self._click_block_until:
+ return
+ if pressed in ("mic", "close") and self._state.active:
+ self._click_block_until = time.monotonic() + self.CLICK_GUARD_S
+ callback = self._on_action
+ if callback is None:
+ return
+ try:
+ callback(pressed)
+ except Exception: # noqa: BLE001 — a bad action must not kill the Tk loop
+ logging.getLogger("jarvis.orb").debug(
+ "orb control action %r failed", pressed, exc_info=True
+ )
+
+
class OrbOverlay:
"""Public facade — Tkinter-based, thread-safe via root.after(0, ...).
@@ -1513,6 +1908,20 @@ class OrbOverlay:
# injects a callable that publishes ``ShowWindowRequested``; the orb
# itself stays bus-agnostic (same contract as the mute toggle).
self._on_show_window: Callable[[], None] | None = None
+ # The control row's actions. Each is optional: wired, the callback
+ # decides (the macOS host forwards it to the parent process, which is
+ # the only place a SpeechPipeline exists); unwired, the row falls back
+ # to the live pipeline in THIS process — the same two-step the Jarvis
+ # Bar uses for its own talk / hang-up buttons.
+ self._on_talk: Callable[[], None] | None = None
+ self._on_hangup: Callable[[], None] | None = None
+ self._on_speaker_toggle: Callable[[], None] | None = None
+ #: The four round controls under the sphere. Only the voice orb wears
+ #: them — the mascot has its own arms and expressions, and a row of
+ #: discs under the ghost would read as a toolbar bolted to a cartoon.
+ self._controls: OrbControlRow | None = None
+ self._pointer_over_orb = False
+ self._speaker_muted = False
# Counter + Tk timer-id for the two-double-click gesture. The
# earlier single-double-click implementation muted Jarvis as soon
# as the user clicked twice on the popup logo, which fired
@@ -1736,6 +2145,10 @@ class OrbOverlay:
self._canvas.bind("<Double-Button-1>", self._on_mute_double_click)
self._canvas.bind("<Button-3>", self._on_right_click)
self._canvas.bind("<Button-2>", self._on_reset_double_click)
+ # Pointer presence drives the control row (see OrbControlRow): reaching
+ # for the orb is the moment its controls become useful.
+ self._canvas.bind("<Enter>", self._on_orb_pointer_enter)
+ self._canvas.bind("<Leave>", self._on_orb_pointer_leave)
# Drag-drop onto the mascot (desktop extra, cross-platform via tkdnd).
# Pure addition, fully guarded: a no-op when tkinterdnd2 is absent
@@ -1758,7 +2171,9 @@ class OrbOverlay:
orb_y=anchor.y,
orb_w=WIN_W,
screen_w=screen_w,
+ theme=bubble_theme_for_style(self._style),
)
+ self._ensure_controls()
self._renderer = self._build_renderer(self._style)
self._t0 = time.perf_counter()
@@ -1839,6 +2254,8 @@ class OrbOverlay:
self._root.geometry(f"{WIN_W}x{WIN_H}+{clamped_x}+{clamped_y}")
if self._comment_bubble is not None:
self._comment_bubble.update_anchor(clamped_x, clamped_y, screen_w)
+ if self._controls is not None:
+ self._controls.update_anchor(clamped_x, clamped_y)
try:
save_position_to_toml(
JARVIS_TOML_PATH,
@@ -1858,6 +2275,8 @@ class OrbOverlay:
self._root.geometry(f"{WIN_W}x{WIN_H}+{anchor.x}+{anchor.y}")
if self._comment_bubble is not None:
self._comment_bubble.update_anchor(anchor.x, anchor.y, screen_w)
+ if self._controls is not None:
+ self._controls.update_anchor(anchor.x, anchor.y)
except (tk.TclError, OSError):
pass
if self._root is not None:
@@ -1901,6 +2320,8 @@ class OrbOverlay:
if self._comment_bubble is not None:
screen_w = self._root.winfo_screenwidth()
self._comment_bubble.update_anchor(new_x, new_y, screen_w)
+ if self._controls is not None:
+ self._controls.update_anchor(new_x, new_y)
def _on_drag_release(self, _event: tk.Event) -> None:
if self._root is not None:
@@ -1925,6 +2346,8 @@ class OrbOverlay:
self._root.geometry(f"{WIN_W}x{WIN_H}+{clamped_x}+{clamped_y}")
except tk.TclError:
pass
+ if self._controls is not None:
+ self._controls.update_anchor(self._mascot_x, self._mascot_y)
self._manual_pinned = True
try:
@@ -1955,6 +2378,212 @@ class OrbOverlay:
"""
self._mute_toggle_callback = callback
+ # ------------------------------------------------------------------
+ # Control row (voice-orb style only)
+ # ------------------------------------------------------------------
+
+ def _controls_wanted(self) -> bool:
+ """Does this style show the control row at all?"""
+ return self._style == "voice_orb"
+
+ def _ensure_controls(self) -> None:
+ """Create or tear down the row so it matches the current style."""
+ if self._root is None:
+ return
+ if not self._controls_wanted():
+ if self._controls is not None:
+ self._controls.destroy()
+ self._controls = None
+ return
+ if self._controls is not None:
+ return
+ try:
+ row = OrbControlRow(
+ parent=self._root,
+ orb_x=self._mascot_x,
+ orb_y=self._mascot_y,
+ orb_w=WIN_W,
+ orb_h=WIN_H,
+ )
+ except tk.TclError:
+ logging.getLogger("jarvis.orb").debug("orb control row unavailable", exc_info=True)
+ return
+ row.set_on_action(self._on_control_action)
+ row.set_state(
+ active=self._mode in ("listen", "think", "speak"),
+ speaker_muted=self._speaker_muted,
+ )
+ self._controls = row
+
+ def _on_orb_pointer_enter(self, _event: tk.Event | None = None) -> None:
+ self._pointer_over_orb = True
+ row = self._controls
+ if row is not None:
+ row.show()
+
+ def _on_orb_pointer_leave(self, _event: tk.Event | None = None) -> None:
+ self._pointer_over_orb = False
+ row = self._controls
+ if row is None:
+ return
+ # A live conversation keeps the controls out: hanging up is the one
+ # thing the user reaches for mid-call, and hunting for a row that hides
+ # itself is worse than a row that stays.
+ if self._mode in ("listen", "think", "speak"):
+ return
+ row.hide_after_grace()
+
+ def _sync_controls_visibility(self) -> None:
+ """Reconcile the row with mode + pointer after a state change."""
+ row = self._controls
+ if row is None:
+ return
+ active = self._mode in ("listen", "think", "speak")
+ row.set_state(active=active)
+ # Never on its own: the row is the orb's controls, so a mode change
+ # arriving while the sphere is withdrawn must not float four buttons
+ # over an empty desktop.
+ if not self._orb_is_visible():
+ row.hide()
+ return
+ if active or self._pointer_over_orb or row.pointer_inside:
+ row.show()
+ else:
+ row.hide_after_grace()
+
+ def _reveal_controls(self) -> None:
+ """Post-deiconify pass: refresh the speaker disc, then place the row."""
+ if self._controls is None:
+ return
+ self._refresh_speaker_state()
+ self._sync_controls_visibility()
+
+ def _orb_is_visible(self) -> bool:
+ if self._root is None:
+ return False
+ try:
+ return bool(self._root.winfo_viewable())
+ except tk.TclError:
+ return False
+
+ def _on_control_action(self, action: str) -> None:
+ """Run one control-row button. Always on the Tk thread."""
+ if action == "attach":
+ self._do_attach()
+ elif action == "mic":
+ self._do_talk_or_hangup()
+ elif action == "close":
+ self._do_close()
+ elif action == "speaker":
+ self._do_speaker_toggle()
+
+ def _do_attach(self) -> None:
+ """Pick files and hand them to the conversation (same path as a drop)."""
+ log = logging.getLogger("jarvis.orb")
+ count = orb_controls.pick_and_dispatch_files(
+ self._root, on_error=lambda message: log.warning("orb attach: %s", message)
+ )
+ if count:
+ log.info("orb attach: handed %d file(s) to the conversation", count)
+
+ def _do_talk_or_hangup(self) -> None:
+ """The mic disc: start a conversation, or end the running one."""
+ if self._mode in ("listen", "think", "speak"):
+ self._do_hangup()
+ return
+ callback = self._on_talk
+ if callback is not None:
+ callback()
+ return
+ pipeline = self._speech_pipeline()
+ starter = getattr(pipeline, "request_voice_session", None)
+ if callable(starter):
+ starter()
+
+ def _do_hangup(self) -> None:
+ callback = self._on_hangup
+ if callback is not None:
+ callback()
+ else:
+ pipeline = self._speech_pipeline()
+ hangup = getattr(pipeline, "request_hangup", None)
+ if callable(hangup):
+ hangup()
+ # Local feedback now instead of waiting for microphone teardown plus
+ # the EventBus round-trip; the authoritative state reconciles it.
+ self._set_mode("idle")
+ self._sync_controls_visibility()
+
+ def _do_close(self) -> None:
+ """X: end the conversation and put the orb away, like the in-app X."""
+ if self._mode in ("listen", "think", "speak"):
+ self._do_hangup()
+ row = self._controls
+ if row is not None:
+ row.hide()
+ self._pointer_over_orb = False
+ self._show_until_t = 0.0
+ self._actually_hide()
+
+ def _do_speaker_toggle(self) -> None:
+ """Silence / restore the assistant's voice for this session only."""
+ callback = self._on_speaker_toggle
+ if callback is not None:
+ callback()
+ # The host process cannot see the pipeline, so it cannot report the
+ # resulting state either. Mirror optimistically — the next reveal
+ # re-reads the truth via _refresh_speaker_state.
+ self._speaker_muted = not self._speaker_muted
+ else:
+ result = orb_controls.toggle_speaker_mute()
+ if result is None:
+ logging.getLogger("jarvis.orb").info(
+ "orb speaker toggle ignored — no live speech pipeline"
+ )
+ return
+ self._speaker_muted = result
+ row = self._controls
+ if row is not None:
+ row.set_state(speaker_muted=self._speaker_muted)
+
+ def _refresh_speaker_state(self) -> None:
+ """Re-read the real TTS mute so the disc cannot drift out of sync."""
+ if self._on_speaker_toggle is not None:
+ return # hosted: this process has no pipeline to ask
+ muted = orb_controls.speaker_is_muted()
+ if muted == self._speaker_muted:
+ return
+ self._speaker_muted = muted
+ row = self._controls
+ if row is not None:
+ row.set_state(speaker_muted=muted)
+
+ @staticmethod
+ def _speech_pipeline():
+ """The live pipeline, or ``None`` off the desktop process."""
+ try:
+ from jarvis.core.runtime_refs import get_speech_pipeline
+ except Exception: # noqa: BLE001 — importable in practice; never fatal
+ return None
+ return get_speech_pipeline()
+
+ def set_on_talk(self, callback: Callable[[], None] | None) -> None:
+ """Inject "start a voice session" (the mic disc while idle).
+
+ Wired by ``jarvis.ui.jarvisbar.host`` when the orb runs in the macOS
+ companion process, where no SpeechPipeline exists; the parent applies
+ it. In-process the orb calls the pipeline itself.
+ """
+ self._on_talk = callback
+
+ def set_on_hangup(self, callback: Callable[[], None] | None) -> None:
+ """Inject "end the running session" (the mic disc while active, and X)."""
+ self._on_hangup = callback
+
+ def set_on_speaker_toggle(self, callback: Callable[[], None] | None) -> None:
+ """Inject the assistant-voice mute toggle (the speaker disc)."""
+ self._on_speaker_toggle = callback
+
def set_on_show_window(self, callback: Callable[[], None] | None) -> None:
"""Inject the right-click → raise-main-window action.
@@ -2091,6 +2720,8 @@ class OrbOverlay:
return
if self._comment_bubble is not None:
self._comment_bubble.update_anchor(anchor.x, anchor.y, screen_w)
+ if self._controls is not None:
+ self._controls.update_anchor(anchor.x, anchor.y)
def _monitor_at_orb_center(self, screens: list) -> tuple[tuple[int, int, int, int], str]:
"""Return (geometry, device_name) of the monitor containing the orb center."""
@@ -2151,6 +2782,12 @@ class OrbOverlay:
# We must NOT block the deiconify path — publish is fire-
# and-forget; failures are swallowed by the publisher.
self._root.after(50, self._publish_visibility_feedback, mode)
+ # Same 50 ms reason: the row asks whether the orb is mapped,
+ # and right after deiconify Tk still says it is not. The
+ # speaker disc re-reads the real TTS mute here too, so a mute
+ # set elsewhere (settings slider, voice command) is reflected
+ # rather than remembered wrong.
+ self._root.after(50, self._reveal_controls)
now = time.perf_counter() - self._t0
self._show_until_t = max(self._show_until_t, now + self.SHOW_MIN_DURATION_S)
@@ -2253,6 +2890,13 @@ class OrbOverlay:
def _actually_hide(self) -> None:
self._pending_hide_after_id = None
+ # The controls belong to the orb, not to the desktop: a row of buttons
+ # left floating where the sphere used to be is a widget with nothing
+ # behind it.
+ row = self._controls
+ if row is not None:
+ row.hide()
+ self._pointer_over_orb = False
if self._root is not None:
try:
self._root.withdraw()
@@ -2281,6 +2925,15 @@ class OrbOverlay:
bubble.hide()
except Exception: # noqa: BLE001
pass
+ try:
+ row = self._controls
+ self._controls = None
+ if row is not None:
+ row.destroy()
+ except Exception: # noqa: BLE001 — teardown must reach root.destroy
+ logging.getLogger("jarvis.orb").debug(
+ "orb control row teardown failed", exc_info=True
+ )
try:
root.destroy()
except Exception: # noqa: BLE001
@@ -2445,6 +3098,13 @@ class OrbOverlay:
return # The fallback case was already logged in _build_renderer
self._renderer = new_renderer
self._style = style
+ # The bubble's look and the control row both belong to the style, so a
+ # live swap has to carry them across or the new sphere inherits the
+ # ghost's yellow bubble (and vice versa).
+ if self._comment_bubble is not None:
+ self._comment_bubble.set_theme(bubble_theme_for_style(style))
+ self._ensure_controls()
+ self._sync_controls_visibility()
def _build_renderer(self, style: str) -> MascotRenderer | VoiceOrbRenderer | None:
if style == "voice_orb":
@@ -2493,7 +3153,10 @@ class OrbOverlay:
validated it; this stays a guard for the internal call sites."""
if mode not in MODES:
raise ValueError(f"Unknown mode: {mode!r} (allowed: {', '.join(MODES)})")
+ changed = mode != self._mode
self._mode = mode
+ if changed:
+ self._sync_controls_visibility()
def _enqueue_ui(self, fn) -> None:
"""Queue UI work for the Tk thread.