Sample Header Ad - 728x90

how to send keyboard strokes programmatically (like "sendkeys" in Windows) to a Wayland Linux window (KDE/GNOME)?

0 votes
1 answer
1200 views
I'm writing a desktop automation software, which drives a GUI desktop, on linux. It works pretty well, but Wayland is blocking inter-window communication, especially when entering non-ASCII characters into text boxes. For comparison, on Windows, I used sendkeys API, and most programs obeyed. On X systems, there's pyautogui, xdotool, and other means, since there's no isolation between windows. The programming solutions I've tested to drive and simulate user input: 1. uinput (python-uinput) 2. pyAutoGui - 3. ydotool ignores non-ASCII (officially). It runs its own daemon though, so it's slower than any direct API or DBus option. 4. wtype doesn't run on KDE nor Gnome. 5. dotool doesn't work for emoji, garbles nonascii 6. kdotool can't type characters. There's a strict permissions issue with Wayland and how it (doesn't) permit(s) inter-window communication. But even when run as root, these tools don't allow non-ASCII characters. I know some ugly workarounds, but they all come with a price tag, such as using the clipboard, and triggering a Ctrl+V event. Any ideas how to send or emulate a keyboard event for unicode non-ASCII? (I'm using Arch-derivatives with KDE, but the same is applicable to Gnome, and maybe other desktop environments.)
Asked by Berry Tsakala (160 rep)
Nov 19, 2024, 09:49 AM
Last activity: Dec 18, 2024, 07:56 PM