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(cu): claim per-monitor DPI at process start — pywebview downgrade broke second-monitor clicks

Ruben Lütke397251613621
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.py
index aec28d7a78..3c2427c4a5 100644
--- a/jarvis/ui/desktop_app.py
+++ b/jarvis/ui/desktop_app.py
@@ -2730,6 +2730,15 @@ class DesktopApp:
def run_window_only(self) -> int:
"""The main-thread pywebview window. Assumes the backend thread is
already running (started by :meth:`run` or the fast-boot launcher)."""
+ # Claim PER_MONITOR_AWARE before pywebview can downgrade the process to
+ # SYSTEM-aware (webview.start does at runtime) — the downgrade
+ # virtualizes window rects on mixed-DPI monitors and made Computer-Use
+ # click hundreds of pixels off on the secondary screen (live forensic
+ # 2026-07-02). Windows honours only the FIRST claim; idempotent no-op
+ # when the launcher already claimed it (the normal path).
+ from jarvis.core.win32_dpi import ensure_dpi_awareness
+
+ ensure_dpi_awareness()
import webview # type: ignore[import-not-found]
if not self._wait_for_backend():
@@ -3273,6 +3282,11 @@ class DesktopApp:
def main() -> int:
"""CLI entry point for ``python -m jarvis.ui.desktop_app``."""
+ # First action of the process: claim per-monitor DPI awareness before any
+ # pywebview code can downgrade it (see run_window_only for the forensic).
+ from jarvis.core.win32_dpi import ensure_dpi_awareness
+
+ ensure_dpi_awareness()
try:
lock = acquire_single_instance_lock()
except SingleInstanceError as exc:
diff --git a/jarvis/ui/web/launcher.py b/jarvis/ui/web/launcher.py
index 6d09346a43..3e91563dd4 100644
--- a/jarvis/ui/web/launcher.py
+++ b/jarvis/ui/web/launcher.py
@@ -35,6 +35,19 @@ if sys.platform == "win32":
except (AttributeError, OSError):
pass
+# DPI awareness — claim PER_MONITOR_AWARE for the whole process BEFORE anything
+# imports pywebview. Windows honours only the FIRST process-awareness claim, and
+# pywebview's webview.start() downgrades an unclaimed process to SYSTEM-aware at
+# runtime — on a multi-monitor desktop with mixed scale factors that virtualizes
+# every window rect, so Computer-Use captured and clicked hundreds of pixels off
+# on the secondary monitor (live forensic 2026-07-02: probe window reported at
+# x=-1989 while physically at x=-1326; clicks 1/4 hits vs 4/4 with the early
+# claim). Same root as the JarvisBar HiDPI shrink (commit 7a6e7d17). No-op off
+# Windows.
+from jarvis.core.win32_dpi import ensure_dpi_awareness as _ensure_dpi_awareness
+
+_ensure_dpi_awareness()
+
# Taskbar-Icon-Fix (Windows): the unique AUMID must be set BEFORE pywebview
# creates the window. Done in ``_run_desktop`` (the only path with a window) so
# the module import — which the headless fast-boot path pays on the