fix(injection): stop typing test during wtype probe (#627)

Fixes #622
This commit is contained in:
Jatin K Malik
2026-08-02 19:41:02 -07:00
committed by GitHub
parent 679ff9161b
commit ced8620e69
3 changed files with 74 additions and 22 deletions
+12 -10
View File
@@ -131,10 +131,7 @@ class TextInjector:
and self.wayland_tool == "wtype"
):
try:
# Try a test with wtype
result = subprocess.run(
["wtype", "test"], stderr=subprocess.PIPE, text=True, check=False
)
result = self._probe_wtype_support()
error_output = result.stderr.lower()
if "compositor does not support" in error_output or result.returncode != 0:
logger.warning(
@@ -178,6 +175,16 @@ class TextInjector:
self._ibus_injector = None
self._ibus_ready = False
def _probe_wtype_support(self) -> subprocess.CompletedProcess:
"""Probe wtype support without typing visible text."""
return subprocess.run(
["wtype", ""],
stderr=subprocess.PIPE,
text=True,
check=False,
timeout=2,
)
def _detect_environment(self) -> DesktopEnvironment:
"""
Detect the current desktop environment (X11 or Wayland).
@@ -836,12 +843,7 @@ class TextInjector:
# Check for wtype with compositor support
if shutil.which("wtype"):
try:
result = subprocess.run(
["wtype", "test"],
stderr=subprocess.PIPE,
text=True,
check=False,
)
result = self._probe_wtype_support()
error_output = result.stderr.lower()
if "compositor does not support" not in error_output and result.returncode == 0:
self.wayland_tool = "wtype"