I'm trying to programmatically assign a key press (F24) to a four-finger tap gesture using the module pynput in Windows. I simply started recording for the shortcut and sent the (F24) key via the following code,
from pynput import keyboardkeyboard.Controller().tap(keyboard.KeyCode.from_vk(int("0x87",16)))
Here are two problems which i don't know if they are correlated:
- Extra Key Presses: When I perform the four-finger tap, the log shows additional key presses (Ctrl, Shift, Cmd) before intended key (F24) press, this seems to be the issue with the F key > 12.
- F24 Persistence: Even after recording a different shortcut (the End key) for four-finger tap after facing this issue, it still logs F24 presses (along with Ctrl, Shift, Cmd) before logging the End key press.
I tried with other gestures like four finger swipes, without passing F keys > 12, the gesture response produced intended key presses. But If I do send an F key > 12, it ruins the gesture, and now it logs F24 (or whatever key is passed) as well. I also tried Ctrl + Alt + Del, reset the touchpad gesture settings, restarted the system but nothing seems to work and my gestures are sending those additional F keys.