fix(niri): conflict-free example keybinds and a niri-aware inject probe (#47)
CI / security (push) Successful in 1m26s
CI / lint (push) Successful in 21s
CI / ai-review (push) Skipped

The niri example binds move to Mod+Shift+M (toggle), Mod+Shift+S (start) and Mod+Shift+X (stop), free in stock niri and in Dank Material Shell's binds. inject-probe reuses the injector's niri guard, so it no longer reports the portal on niri.

Fixes #45
Fixes #46
This commit was merged in pull request #47.
This commit is contained in:
2026-11-06 18:29:29 +00:00
parent a4a831c3c6
commit a451e1d512
6 changed files with 170 additions and 21 deletions
+18 -10
View File
@@ -433,8 +433,11 @@ def cmd_inject_probe(args: argparse.Namespace) -> int:
Never emits keystrokes: end-to-end key-to-screen latency would type
into the live desktop, so it stays a hardware-checklist item (#32).
On niri the portal is skipped with the injector's own niri guard: the
injector never offers the portal there, so the report must not claim it.
"""
from vocalinux.text_injection.text_injector import TextInjector
from vocalinux.text_injection.text_injector import TextInjector, _is_niri_session
probe_text = "the quick brown fox jumps over the lazy dog 0123456789"
started = time.monotonic()
@@ -462,16 +465,20 @@ def cmd_inject_probe(args: argparse.Namespace) -> int:
env=host_env(),
)
wtype_roundtrips.append(time.monotonic() - begin)
try:
from vocalinux.text_injection.remote_desktop_portal import RemoteDesktopPortal
portal_available = False
portal_seconds = None
portal_skip_reason = "niri" if _is_niri_session() else None
if portal_skip_reason is None:
try:
from vocalinux.text_injection.remote_desktop_portal import RemoteDesktopPortal
portal_started = time.monotonic()
portal_available = RemoteDesktopPortal().probe()
portal_seconds = time.monotonic() - portal_started
except Exception as exc: # noqa: BLE001 - probe must never fail the pass
portal_available = False
portal_seconds = None
print(f"portal probe raised: {exc}", file=sys.stderr)
portal_started = time.monotonic()
portal_available = RemoteDesktopPortal().probe()
portal_seconds = time.monotonic() - portal_started
except Exception as exc: # noqa: BLE001 - probe must never fail the pass
portal_available = False
portal_seconds = None
print(f"portal probe raised: {exc}", file=sys.stderr)
print(
json.dumps(
{
@@ -481,6 +488,7 @@ def cmd_inject_probe(args: argparse.Namespace) -> int:
"wtype_empty_roundtrip_stats": describe(wtype_roundtrips),
"portal_available": portal_available,
"portal_probe_seconds": portal_seconds,
"portal_skip_reason": portal_skip_reason,
},
indent=2,
sort_keys=True,