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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(hotkeys): a box without a display never reports shortcuts armed
rubenluetke10-beepa6084f22bf22
diff --git a/jarvis/platform/probes.py b/jarvis/platform/probes.pyindex f0e2a7de28..cd485e4066 100644--- a/jarvis/platform/probes.py+++ b/jarvis/platform/probes.py@@ -128,8 +128,28 @@ def has_hotkey() -> bool:plat = detect_platform()if plat == "win32":return _has_module("global_hotkeys")- # macOS/Linux use pynput; Wayland blocks global grabs by design (AD-8).- return _has_module("pynput") and not is_wayland()+ # macOS/Linux use pynput; Wayland blocks global grabs by design (AD-8),+ # and a headless box has no keyboard to listen to.+ return _has_module("pynput") and display_present() and not is_wayland()+++def hotkey_unavailable_reason() -> str:+ """Why :func:`has_hotkey` says no, in words a person can act on."""+ plat = detect_platform()+ if plat != "win32":+ if not display_present():+ return "There is no desktop on this computer, so there is no keyboard to listen to."+ if is_wayland():+ return (+ "Wayland does not let apps listen for global shortcuts. Use an X11 "+ "session, or ask by voice or with the button."+ )+ if plat == "linux" and not _has_module("pynput"):+ return (+ "Global shortcuts need the desktop-linux extra: "+ 'pip install "personal-jarvis[desktop-linux]".'+ )+ return "Global shortcuts are not available on this desktop."def has_cursor() -> bool:@@ -191,6 +211,7 @@ __all__ = ["screen_recording_granted","has_ax_tree","has_hotkey",+ "hotkey_unavailable_reason","has_cursor","has_overlay","has_elevation",diff --git a/tests/unit/platform/test_probes.py b/tests/unit/platform/test_probes.pyindex 0dfc66e3fb..e18110d7c7 100644--- a/tests/unit/platform/test_probes.py+++ b/tests/unit/platform/test_probes.py@@ -76,11 +76,31 @@ def test_has_hotkey_false_on_wayland(monkeypatch):def test_has_hotkey_true_on_x11_with_pynput(monkeypatch):_force_platform(monkeypatch, "linux")+ monkeypatch.setenv("DISPLAY", ":0")monkeypatch.setattr(probes, "is_wayland", lambda: False)monkeypatch.setattr(probes, "_has_module", lambda n: n == "pynput")assert probes.has_hotkey() is True+def test_has_hotkey_false_on_a_headless_box_with_pynput(monkeypatch):+ """No display, no keyboard: the shortcut must not report itself armed."""+ _force_platform(monkeypatch, "linux")+ monkeypatch.delenv("DISPLAY", raising=False)+ monkeypatch.delenv("WAYLAND_DISPLAY", raising=False)+ monkeypatch.setattr(probes, "is_wayland", lambda: False)+ monkeypatch.setattr(probes, "_has_module", lambda n: n == "pynput")+ assert probes.has_hotkey() is False+ assert "no desktop" in probes.hotkey_unavailable_reason()+++def test_a_missing_pynput_names_the_extra(monkeypatch):+ _force_platform(monkeypatch, "linux")+ monkeypatch.setenv("DISPLAY", ":0")+ monkeypatch.setattr(probes, "is_wayland", lambda: False)+ monkeypatch.setattr(probes, "_has_module", lambda _n: False)+ assert "personal-jarvis[desktop-linux]" in probes.hotkey_unavailable_reason()++def test_has_hotkey_windows_uses_global_hotkeys(monkeypatch):_force_platform(monkeypatch, "win32")monkeypatch.setattr(probes, "_has_module", lambda n: n == "global_hotkeys")