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.

fix(macos): restore native desktop window controls (#355)

Ruben Lütkeacc12801dab4
diff --git a/.github/workflows/macos-desktop.yml b/.github/workflows/macos-desktop.yml
index 18123137f9..99b26b5831 100644
--- a/.github/workflows/macos-desktop.yml
+++ b/.github/workflows/macos-desktop.yml
@@ -282,6 +282,10 @@ jobs:
tests/unit/ui/web/test_permissions_snapshot.py \
tests/unit/ui/web/test_keybinds_input_monitoring_ask.py \
tests/unit/ui/test_desktop_macos_permission_gate.py \
+ tests/unit/ui/test_window_command.py \
+ tests/unit/ui/test_desktop_detached_windows.py \
+ tests/unit/ui/test_desktop_background.py \
+ tests/unit/ui/test_window_fullscreen.py \
tests/unit/setup/test_macos_app_bundle.py \
tests/unit/setup/test_desktop_integration.py \
tests/unit/autostart/test_macos.py \
diff --git a/docs/os-parity.md b/docs/os-parity.md
index d0fb3e8469..976ca59b7f 100644
--- a/docs/os-parity.md
+++ b/docs/os-parity.md
@@ -1,5 +1,24 @@
# OS Feature Parity — macOS / Linux Gap Register
+## Native macOS window controls (2026-10-03, T2)
+
+Main, reopened main, and detached windows retain Cocoa's native title bar on
+macOS. The red, yellow, and green traffic lights belong to the operating system;
+the frontend renders no duplicate caption buttons. Native zoom/fullscreen no
+longer goes through the web-caption maximize/restore toggle, whose pywebview
+Cocoa restore operation only deminiaturizes. Existing close/background and
+detached-window lifecycle handling remains attached to the native window events.
+Windows and Linux retain their existing frameless web captions.
+
+Regression coverage checks all three platform configurations, reopened and
+detached window creation, the chrome API, and the existing close/background
+lifecycle. The macOS desktop lane runs these tests on Intel, Apple Silicon,
+and standalone Python alongside its dependency and application-bundle checks.
+These automated checks do not replace a physical Mac acceptance pass: verify
+red close, yellow minimize/Dock restore, green fullscreen/exit and Option-green
+zoom in light and dark appearance, including a detached view and a reopened
+main window. This Windows development host cannot qualify those native clicks.
+
## Current cryptography and SSH channel validation (2026-10-01, T3)
Every architecture now requires cryptography >=50.0.2 and AsyncSSH >=2.24.0.
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.py
index ed4d425ff8..476d37c456 100644
--- a/jarvis/ui/desktop_app.py
+++ b/jarvis/ui/desktop_app.py
@@ -5103,7 +5103,8 @@ class DesktopApp:
height=750,
min_size=(800, 520),
resizable=True,
- frameless=True,
+ # Cocoa owns the traffic lights and their native zoom/fullscreen behavior.
+ frameless=sys.platform != "darwin",
easy_drag=False,
confirm_close=False,
background_color=self._window_background(),
@@ -5274,7 +5275,8 @@ class DesktopApp:
"height": 800,
"min_size": (900, 600),
"resizable": True,
- "frameless": True,
+ # Keep Cocoa's real close/minimize/zoom controls on every main window.
+ "frameless": sys.platform != "darwin",
"easy_drag": False,
"confirm_close": False,
"background_color": self._window_background(),
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
index f7eb806baa..59276d1ff9 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { TopBar, TopBarActions } from "./TopBar";
import { ThemeProvider } from "@/hooks/useTheme";
@@ -187,6 +187,27 @@ describe("TopBar section navigation", () => {
});
describe("TopBar caption on every section", () => {
+ it.each([false, true])("leaves native macOS controls to Cocoa (solo=%s)", async (solo) => {
+ useEventStore.setState({ solo });
+ (window as unknown as { pywebview?: { api: object } }).pywebview = { api: {} };
+ const fetchMock = vi.fn().mockResolvedValue({
+ ok: true,
+ json: async () => ({ ok: true, frameless: false, controls: "none", platform: "darwin" }),
+ });
+ vi.stubGlobal("fetch", fetchMock);
+
+ try {
+ await act(async () => { render(<TopBar />); });
+ expect(fetchMock).toHaveBeenCalledWith("/api/window/chrome");
+ expect(screen.queryByTestId("window-controls")).toBeNull();
+ fireEvent.doubleClick(screen.getByTestId("window-caption").querySelector(".pywebview-drag-region")!);
+ expect(fetchMock.mock.calls.some(([url]) => url === "/api/window/command")).toBe(false);
+ expect(screen.getByRole("button", { name: /^restart$/i })).toBeTruthy();
+ } finally {
+ delete (window as unknown as { pywebview?: unknown }).pywebview;
+ }
+ });
+
it.each(["chats", "agents", "agentic-ide-classic", "dictation"] as const)(
"keeps restart on %s",
(section) => {
diff --git a/jarvis/ui/window_command.py b/jarvis/ui/window_command.py
index f5ec44f05b..0d93c2a5a8 100644
--- a/jarvis/ui/window_command.py
+++ b/jarvis/ui/window_command.py
@@ -19,13 +19,13 @@ _ACTIONS = frozenset({"minimize", "maximize", "close"})
def window_chrome(platform: str | None = None) -> dict[str, Any]:
"""Where the page should put the window buttons.
- macOS keeps them on the left, like the traffic lights they replace.
- Windows and Linux keep them on the right. ``frameless`` is filled in by
- the desktop shell from the live window — this helper only names the side.
+ macOS uses Cocoa's native traffic lights, so the page draws no controls.
+ Windows and Linux keep their web controls on the right. ``frameless`` is
+ filled in by the desktop shell from the live window.
"""
plat = platform if platform is not None else sys.platform
if plat == "darwin":
- name, controls = "darwin", "leading"
+ name, controls = "darwin", "none"
elif plat == "win32":
name, controls = "windows", "trailing"
else:
@@ -43,8 +43,8 @@ def run_window_command(
``maximized`` is the operating system's answer when the caller has one
(Windows ``IsZoomed``). Without it, the last action this process took is
- the answer — enough for macOS and Linux, where only these buttons change
- that state.
+ the fallback answer. macOS uses native caption controls instead of this
+ web-caption toggle: Cocoa's restore API only deminiaturizes a window.
"""
if window is None:
return {"ok": False, "reason": "no_window"}
diff --git a/tests/unit/ui/test_desktop_detached_windows.py b/tests/unit/ui/test_desktop_detached_windows.py
index b7bd1cae24..bf4b19ce2b 100644
--- a/tests/unit/ui/test_desktop_detached_windows.py
+++ b/tests/unit/ui/test_desktop_detached_windows.py
@@ -61,10 +61,12 @@ def _fake_webview(created: list[_FakeWindow], *, fail: bool = False) -> ModuleTy
class WebViewException(Exception):
pass
- def create_window(title: str, url: str, **_kwargs: Any) -> _FakeWindow:
+ def create_window(title: str, url: str, **kwargs: Any) -> _FakeWindow:
if fail:
raise WebViewException("runtime window creation unsupported")
window = _FakeWindow(title, url)
+ window.frameless = kwargs.get("frameless", False)
+ window.resizable = kwargs.get("resizable", True)
created.append(window)
return window
@@ -108,10 +110,12 @@ def _app(monkeypatch: pytest.MonkeyPatch | None = None) -> DesktopApp:
# --- open_detached_window ----------------------------------------------------
-def test_open_detached_creates_titled_solo_window(monkeypatch) -> None:
[email protected]("platform", ["darwin", "win32", "linux"])
+def test_open_detached_creates_titled_solo_window(monkeypatch, platform) -> None:
import sys
app = _app(monkeypatch)
+ monkeypatch.setattr(sys, "platform", platform)
created: list[_FakeWindow] = []
monkeypatch.setitem(sys.modules, "webview", _fake_webview(created))
@@ -120,6 +124,8 @@ def test_open_detached_creates_titled_solo_window(monkeypatch) -> None:
assert result == {"ok": True, "already_open": False, "view": "agentic-ide"}
assert len(created) == 1
window = created[0]
+ assert window.frameless is (platform != "darwin")
+ assert window.resizable is True
# Distinct title: FindWindowW-exact focus and the icon setter key on it.
assert window.title == f"{WINDOW_TITLE} — Agents"
assert window.title != WINDOW_TITLE
@@ -311,10 +317,12 @@ def test_snapshot_lists_detached_views(monkeypatch) -> None:
# --- _ensure_main_window -----------------------------------------------------
-def test_ensure_main_window_recreates_and_rehooks(monkeypatch) -> None:
[email protected]("platform", ["darwin", "win32", "linux"])
+def test_ensure_main_window_recreates_and_rehooks(monkeypatch, platform) -> None:
import sys
app = _app(monkeypatch)
+ monkeypatch.setattr(sys, "platform", platform)
app._window = None
created: list[_FakeWindow] = []
monkeypatch.setitem(sys.modules, "webview", _fake_webview(created))
@@ -324,12 +332,32 @@ def test_ensure_main_window_recreates_and_rehooks(monkeypatch) -> None:
assert len(created) == 1
assert created[0].title == WINDOW_TITLE
assert app._window is created[0]
+ assert created[0].frameless is (platform != "darwin")
+ assert created[0].resizable is True
assert app._window_visible is True
assert len(created[0].events.closing) == 1 # quit contract re-attached
assert len(created[0].events.closed) == 1 # null-out re-attached
assert len(created[0].events.loaded) == 2 # drop bridge and authenticated shell restore
[email protected]("platform", ["darwin", "win32", "linux"])
+def test_main_window_chrome_matches_native_frame(monkeypatch, platform) -> None:
+ import sys
+
+ app = _app(monkeypatch)
+ monkeypatch.setattr(sys, "platform", platform)
+ options = app._main_window_kwargs()
+ assert options["frameless"] is (platform != "darwin")
+ assert options["resizable"] is True
+ app._window.frameless = options["frameless"]
+ snapshot = app.window_chrome_snapshot()
+ assert snapshot["frameless"] is options["frameless"]
+ assert snapshot["controls"] == ("none" if platform == "darwin" else "trailing")
+
+ app._window = None
+ assert app.window_chrome_snapshot()["controls"] == "none"
+
+
# --- native drop bridge --------------------------------------------------------
diff --git a/tests/unit/ui/test_window_command.py b/tests/unit/ui/test_window_command.py
index a1e76c2056..9a28524640 100644
--- a/tests/unit/ui/test_window_command.py
+++ b/tests/unit/ui/test_window_command.py
@@ -27,7 +27,7 @@ class Window:
def test_chrome_side_follows_the_platform():
- assert window_chrome("darwin")["controls"] == "leading"
+ assert window_chrome("darwin")["controls"] == "none"
assert window_chrome("win32")["controls"] == "trailing"
assert window_chrome("linux")["controls"] == "trailing"
assert window_chrome("win32")["frameless"] is False