From 4a72c96b5f01b5430627ded13c736b7666f54cf5 Mon Sep 17 00:00:00 2001 From: Jatin K Malik Date: Wed, 11 Feb 2026 17:26:21 -0800 Subject: [PATCH] fix(text-injection): check ydotoold daemon before selecting ydotool (#176) --- src/vocalinux/text_injection/text_injector.py | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/vocalinux/text_injection/text_injector.py b/src/vocalinux/text_injection/text_injector.py index c5cbb41..7244162 100644 --- a/src/vocalinux/text_injection/text_injector.py +++ b/src/vocalinux/text_injection/text_injector.py @@ -125,10 +125,27 @@ class TextInjector: xdotool_available = shutil.which("xdotool") is not None if ydotool_available: - self.wayland_tool = "ydotool" - logger.info( - f"Using {self.wayland_tool} for Wayland text injection (universal compatibility)" - ) + # Verify ydotoold daemon is running before selecting ydotool + try: + subprocess.run( + ["ydotool", "type", ""], check=True, stderr=subprocess.PIPE, timeout=2 + ) + self.wayland_tool = "ydotool" + logger.info( + f"Using {self.wayland_tool} for Wayland text injection (universal compatibility)" + ) + except ( + subprocess.CalledProcessError, + subprocess.TimeoutExpired, + FileNotFoundError, + ): + if wtype_available: + self.wayland_tool = "wtype" + logger.info( + f"Using {self.wayland_tool} for Wayland text injection (ydotoold not running)" + ) + else: + logger.warning("ydotool found but ydotoold daemon not running") elif wtype_available: self.wayland_tool = "wtype" logger.info(f"Using {self.wayland_tool} for Wayland text injection")