From a07869f8be51fae0d5613baaa6b49f435da1af6d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Mar 2026 21:42:45 +0000 Subject: [PATCH] Skip virtual keyboard devices (ydotoold) in device detection find_keyboard() was matching ydotoold virtual device instead of the real AT Translated Set 2 keyboard because evdev lists devices in reverse order. Now skips devices with 'virtual' or 'ydotool' in name. https://claude.ai/code/session_01XKYC1basxdwtHy71tky7xm --- openwhispr-ptt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openwhispr-ptt.py b/openwhispr-ptt.py index c9423ca..0c25d64 100644 --- a/openwhispr-ptt.py +++ b/openwhispr-ptt.py @@ -60,9 +60,13 @@ def send_whispr_toggle(): def find_keyboard(): - """Find the keyboard device.""" + """Find the real physical keyboard device (not virtual devices).""" devices = [evdev.InputDevice(path) for path in evdev.list_devices()] for dev in devices: + # Skip virtual devices (ydotool, xdotool, etc.) + name_lower = dev.name.lower() + if "virtual" in name_lower or "ydotool" in name_lower: + continue caps = dev.capabilities(verbose=False) if ecodes.EV_KEY in caps: keys = caps[ecodes.EV_KEY]