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): bundle the desktop icon in-package so the taskbar shows Jarvis, not Python

Ruben Lütkee012943f653c
diff --git a/jarvis/assets/__init__.py b/jarvis/assets/__init__.py
index 250242189f..1dd8ec224d 100644
--- a/jarvis/assets/__init__.py
+++ b/jarvis/assets/__init__.py
@@ -11,6 +11,12 @@ Currently:
drags torch) lives only in the ``[local-voice]`` extra, but the model file
itself is torch-free and run via base ``onnxruntime``. Loaded via
:func:`bundled_silero_vad_model`.
+- ``icons/``: the Windows desktop/taskbar icon (``jarvis.ico``, the Gigi ghost
+ mascot). Bundled so every Win32 icon surface (window class icon, AUMID icon,
+ Start-Menu shortcut, taskbar name) can find it regardless of how the package
+ was installed. Loaded via :func:`bundled_app_icon`. Byte-identical to the
+ build-tool copy at ``<repo-root>/assets/icons/jarvis.ico`` (kept in sync by
+ ``tests/unit/ui/test_icon_identity.py``).
Future bundles (e.g. packaged voice clips) live under this package.
"""
@@ -28,6 +34,9 @@ _WAKEWORD_FILES = {
_VAD_DIR = Path(__file__).resolve().parent / "vad"
_SILERO_VAD_FILE = "silero_vad.onnx"
+_ICONS_DIR = Path(__file__).resolve().parent / "icons"
+_APP_ICON_FILE = "jarvis.ico"
+
def bundled_wakeword_models() -> dict[str, Path] | None:
"""Return absolute paths to the bundled openWakeWord ONNX assets.
@@ -68,4 +77,27 @@ def bundled_silero_vad_model() -> Path | None:
return path if path.is_file() else None
-__all__ = ["bundled_wakeword_models", "bundled_silero_vad_model"]
+def bundled_app_icon() -> Path | None:
+ """Return the absolute path to the bundled ``jarvis.ico``, or ``None``.
+
+ ``None`` only when the file is missing (partial checkout). Shipping the icon
+ *inside* the package — rather than at ``<repo-root>/assets/icons/`` where the
+ build-tool copy lives — is what makes the Windows taskbar/titlebar icon work
+ on a fresh install no matter how it was installed. The legacy repo-root path
+ resolves only for a run *from the project folder* (``parents[2]`` == repo
+ root); a real ``pip install`` puts the package under ``site-packages`` where
+ that repo-root ``assets/`` does not exist, so every Win32 icon surface (class
+ icon, AUMID icon, Start-Menu shortcut, taskbar name) silently fell back to
+ the ``pythonw.exe`` Python logo. The in-package copy always ships with the
+ code (``package-data`` glob ``assets/**/*``). Same fix class as the bundled
+ Silero VAD model above.
+ """
+ path = _ICONS_DIR / _APP_ICON_FILE
+ return path if path.is_file() else None
+
+
+__all__ = [
+ "bundled_wakeword_models",
+ "bundled_silero_vad_model",
+ "bundled_app_icon",
+]
diff --git a/jarvis/assets/icons/jarvis.ico b/jarvis/assets/icons/jarvis.ico
new file mode 100644
index 0000000000..4032c96056
Binary files /dev/null and b/jarvis/assets/icons/jarvis.ico differ
diff --git a/jarvis/ui/icon_utils.py b/jarvis/ui/icon_utils.py
index 53e994bf45..145b3d94fd 100644
--- a/jarvis/ui/icon_utils.py
+++ b/jarvis/ui/icon_utils.py
@@ -416,9 +416,38 @@ def load_ico_as_pil_image(ico_path: Path, size: int = 64) -> Any | None:
def project_icon_path() -> Path:
- """Resolves the default icon path: ``<project-root>/assets/icons/jarvis.ico``.
-
- The file lives outside the ``jarvis`` package. We go up three levels
- from ``jarvis/ui/icon_utils.py`` to the project root.
+ """Resolve the desktop/taskbar icon (``jarvis.ico``), install-layout agnostic.
+
+ Every Win32 icon surface (window class icon, AUMID icon, Start-Menu shortcut,
+ taskbar name, tray) resolves the icon through this one function — so if it
+ returns a non-existent path, ALL of them silently fall back to the
+ ``pythonw.exe`` Python logo. That is exactly the "taskbar shows Python on a
+ fresh machine" symptom: the icon historically lived only at
+ ``<repo-root>/assets/icons/jarvis.ico`` (``parents[2]``), which resolves only
+ for a run *from the project folder*; a real ``pip install`` relocates the
+ package to ``site-packages`` where that repo-root ``assets/`` is absent.
+
+ Resolution order (first existing wins):
+ 1. the **bundled** in-package copy ``jarvis/assets/icons/jarvis.ico`` — ships
+ with the code via ``package-data``, so it is present on every install;
+ 2. the legacy ``<repo-root>/assets/icons/jarvis.ico`` — the dev/editable and
+ build-tool copy (PyInstaller spec, ``install_shortcuts.py``).
+
+ Falls back to the bundled path (even if missing) so callers get a stable,
+ descriptive path in log warnings.
"""
- return Path(__file__).resolve().parents[2] / "assets" / "icons" / "jarvis.ico"
+ try:
+ from jarvis.assets import bundled_app_icon
+
+ bundled = bundled_app_icon()
+ if bundled is not None:
+ return bundled
+ except Exception as exc: # noqa: BLE001 — never let icon resolution crash boot
+ logger.debug("bundled_app_icon lookup failed, trying repo-root: {}", exc)
+
+ repo_root = Path(__file__).resolve().parents[2] / "assets" / "icons" / "jarvis.ico"
+ if repo_root.is_file():
+ return repo_root
+
+ # Nothing found — return the bundled location for a descriptive warning.
+ return Path(__file__).resolve().parent.parent / "assets" / "icons" / "jarvis.ico"
diff --git a/tests/unit/ui/test_icon_identity.py b/tests/unit/ui/test_icon_identity.py
index 98ca08a93d..9312a93d15 100644
--- a/tests/unit/ui/test_icon_identity.py
+++ b/tests/unit/ui/test_icon_identity.py
@@ -26,6 +26,7 @@ from jarvis.ui.icon_utils import (
APP_USER_MODEL_ID,
START_MENU_SHORTCUT_NAME,
ensure_start_menu_shortcut,
+ project_icon_path,
register_windows_app_user_model_id,
)
@@ -57,6 +58,66 @@ def _delete_test_key() -> None:
pass
+# ---------------------------------------------------------------------------
+# Icon RESOLUTION — the single point every Win32 icon surface depends on.
+#
+# The window class icon, AUMID icon, Start-Menu shortcut, taskbar name and tray
+# all resolve the icon through ``project_icon_path()``. If that returns a path
+# that does not exist, ALL of them silently fall back to the ``pythonw.exe``
+# Python logo — the "taskbar shows Python on a fresh machine" report. The icon
+# used to live ONLY at ``<repo-root>/assets/icons/jarvis.ico`` (found via
+# ``parents[2]``), which resolves only for a run from the project folder; a real
+# ``pip install`` relocates the package to ``site-packages`` where that repo-root
+# ``assets/`` is absent. The fix bundles the icon inside the package. These
+# tests are platform-neutral on purpose: the bug is about file *presence*, which
+# must hold on every OS / CI runner, not just Windows.
+# ---------------------------------------------------------------------------
+
+
+def test_project_icon_path_always_exists() -> None:
+ """The resolved desktop icon must be a real file on every install layout."""
+ p = project_icon_path()
+ assert p.is_file(), (
+ f"project_icon_path() -> {p} does not exist; every Win32 icon surface "
+ "would fall back to the pythonw.exe Python logo"
+ )
+ assert p.suffix == ".ico"
+
+
+def test_project_icon_path_prefers_bundled_in_package_copy() -> None:
+ """The primary resolution is the in-package copy, so it ships with any install."""
+ from jarvis.assets import bundled_app_icon
+
+ bundled = bundled_app_icon()
+ assert bundled is not None and bundled.is_file()
+ # The in-package copy lives under jarvis/assets/icons/, NOT the repo root.
+ assert bundled.as_posix().endswith("jarvis/assets/icons/jarvis.ico")
+ # project_icon_path() returns exactly that bundled copy when present.
+ assert project_icon_path() == bundled
+
+
+def test_bundled_icon_is_byte_identical_to_repo_root_copy() -> None:
+ """Drift guard: the packaged icon must match the build-tool repo-root copy.
+
+ The repo-root ``assets/icons/jarvis.ico`` is still referenced by the
+ PyInstaller spec and ``scripts/install_shortcuts.py``. Keeping the two copies
+ byte-identical means updating the brand icon in one place without the runtime
+ and the installer drifting apart. If this fails, re-copy the repo-root icon
+ into ``jarvis/assets/icons/``.
+ """
+ repo_root = Path(__file__).resolve().parents[3] / "assets" / "icons" / "jarvis.ico"
+ if not repo_root.is_file():
+ pytest.skip("repo-root icon copy absent (slim checkout)")
+ from jarvis.assets import bundled_app_icon
+
+ bundled = bundled_app_icon()
+ assert bundled is not None
+ assert bundled.read_bytes() == repo_root.read_bytes(), (
+ "jarvis/assets/icons/jarvis.ico drifted from assets/icons/jarvis.ico — "
+ "re-copy the repo-root icon into the package"
+ )
+
+
def test_app_display_name_is_personal_jarvis() -> None:
assert APP_DISPLAY_NAME == "Personal Jarvis"
# The grouping key itself stays the stable PascalCase AUMID.