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(trigger): avoid invalid AltGr escape warning (#827)

Danny Ward8e8fcd824213
diff --git a/dodaios/trigger/backends/global_hotkeys.py b/dodaios/trigger/backends/global_hotkeys.py
index 438620b670..62814e8212 100644
--- a/dodaios/trigger/backends/global_hotkeys.py
+++ b/dodaios/trigger/backends/global_hotkeys.py
@@ -599,7 +599,7 @@ _VK_RMENU = 0xA5
# Characters that sit on AltGr on every common AltGr layout (German ``@ € { \``,
# French ``@ # {``, Nordic ``@ $ {`` …). A US layout types all of them without
# Ctrl+Alt, so none of them reports that shift state there.
-_ALTGR_PROBE_CHARS = "@€{[]}\|~"
+_ALTGR_PROBE_CHARS = r"@€{[]}\|~"
_altgr_layout_cache: dict[int, bool] = {}
diff --git a/tests/unit/trigger/test_hotkey_altgr_guard.py b/tests/unit/trigger/test_hotkey_altgr_guard.py
index 859e1fb00f..66ad50cad0 100644
--- a/tests/unit/trigger/test_hotkey_altgr_guard.py
+++ b/tests/unit/trigger/test_hotkey_altgr_guard.py
@@ -9,6 +9,8 @@ Jarvis Bar (live log, 2026-09-29).
from __future__ import annotations
import asyncio
+import warnings
+from pathlib import Path
import pytest
@@ -67,3 +69,19 @@ def test_probe_is_a_quiet_no_on_hosts_without_win32() -> None:
# Off Windows GetAsyncKeyState is unavailable; the guard must never drop.
if global_hotkeys._async_key_is_down(0x10) is None:
assert global_hotkeys.altgr_is_down() is False
+
+
+def test_global_hotkeys_source_has_no_invalid_escape_warning() -> None:
+ assert global_hotkeys._ALTGR_PROBE_CHARS == r"@€{[]}\|~"
+ source_path = Path(global_hotkeys.__file__)
+ source = source_path.read_text(encoding="utf-8")
+ with warnings.catch_warnings(record=True) as caught:
+ warnings.simplefilter("always")
+ compile(source, str(source_path), "exec")
+
+ invalid_escapes = [
+ warning
+ for warning in caught
+ if "invalid escape sequence" in str(warning.message) and "\\|" in str(warning.message)
+ ]
+ assert not invalid_escapes, "\n".join(str(warning.message) for warning in invalid_escapes)