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(ui): hand the app icon to pywebview so the Linux title bar shows Jarvis

rubenluetke10-beepfb228c83a5ce
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.py
index 4f2210c873..8e0507c245 100644
--- a/jarvis/ui/desktop_app.py
+++ b/jarvis/ui/desktop_app.py
@@ -5168,6 +5168,7 @@ class DesktopApp:
debug=debug,
private_mode=storage_dir is None,
storage_path=str(storage_dir) if storage_dir is not None else None,
+ icon=self._native_window_icon(),
)
except webview.WebViewException as exc:
# Not swallowed: the exception is handed to the degrade path, which
@@ -5263,6 +5264,39 @@ class DesktopApp:
_logger.info("Interrupted — shutting the browser-UI fallback down.")
return self.shutdown() or 0
+ @staticmethod
+ def _native_window_icon() -> str | None:
+ """Icon path handed to ``webview.start(icon=...)`` — Linux/macOS only.
+
+ The WM_CLASS ↔ ``.desktop`` ``StartupWMClass`` handshake only feeds the
+ dock/taskbar. The window's own TITLE BAR is drawn by the window manager
+ (xfwm4, Mutter, KWin, …) from ``_NET_WM_ICON`` on the window itself; it
+ never consults a ``.desktop`` file. Without the ``icon=`` argument
+ pywebview's GTK/Qt backend leaves that property unset and the title bar
+ shows the WM's generic window glyph (forensic 2026-09-02, Linux VM).
+ pywebview applies the file via ``set_icon_from_file`` +
+ ``set_default_icon_from_file``, so detached windows inherit it too.
+
+ Windows is deliberately excluded: pywebview's WinForms backend would
+ construct ``System.Drawing.Icon`` from the PNG (which throws), and the
+ Win32 ``WM_SETICON`` poll in ``_start_icon_setter_thread`` already owns
+ that surface with the multi-resolution ``.ico``.
+ """
+ if sys.platform == "win32":
+ return None
+ try:
+ from jarvis.assets import bundled_app_icon_png
+
+ png = bundled_app_icon_png()
+ except Exception as exc: # noqa: BLE001 — icon is cosmetic, never blocks the window
+ from loguru import logger
+
+ logger.debug("bundled PNG icon lookup failed: {}", exc)
+ return None
+ if png is None or not png.is_file():
+ return None
+ return str(png)
+
def _start_icon_setter_thread(self) -> None:
"""Polling thread: sets the taskbar/titlebar icon once the HWND exists.
diff --git a/tests/unit/ui/test_platform_icon_surfaces.py b/tests/unit/ui/test_platform_icon_surfaces.py
index ee891d1fa3..2f48df5f1d 100644
--- a/tests/unit/ui/test_platform_icon_surfaces.py
+++ b/tests/unit/ui/test_platform_icon_surfaces.py
@@ -13,6 +13,7 @@ Windows shows the taskbar icon of the LAUNCHING exe (covered by
The Linux entry is pure text I/O behind a test seam (``applications_dir``), so
its contract is provable on every OS.
"""
+
from __future__ import annotations
import sys
@@ -86,3 +87,39 @@ def test_desktop_app_wires_all_three_platform_surfaces() -> None:
"apply_macos_dock_icon",
):
assert hook in src, hook
+
+
+# The title bar is a FOURTH surface: the window manager draws it from
+# ``_NET_WM_ICON`` on the window itself and never consults a ``.desktop`` file,
+# so the WM_CLASS handshake above leaves it on the WM's generic window glyph
+# (forensic 2026-09-02, Linux VM). pywebview sets that property only when
+# ``start(icon=...)`` is given.
+
+
+def test_native_window_icon_is_the_bundled_png_off_windows(monkeypatch: pytest.MonkeyPatch) -> None:
+ import jarvis.ui.desktop_app as desktop_app
+
+ monkeypatch.setattr(sys, "platform", "linux")
+ icon = desktop_app.DesktopApp._native_window_icon()
+
+ assert icon is not None
+ assert icon.endswith(".png")
+ assert Path(icon).is_file()
+
+
+def test_native_window_icon_is_none_on_windows(monkeypatch: pytest.MonkeyPatch) -> None:
+ """WinForms would build ``System.Drawing.Icon`` from the PNG and throw; the
+ Win32 ``WM_SETICON`` poll owns that surface."""
+ import jarvis.ui.desktop_app as desktop_app
+
+ monkeypatch.setattr(sys, "platform", "win32")
+ assert desktop_app.DesktopApp._native_window_icon() is None
+
+
+def test_desktop_app_hands_the_icon_to_webview_start() -> None:
+ import inspect
+
+ import jarvis.ui.desktop_app as desktop_app
+
+ src = inspect.getsource(desktop_app.DesktopApp.run_window_only)
+ assert "icon=self._native_window_icon()" in src