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
This commit is contained in:
+5
-1
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user