moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.79k stars 248 forks source link

keyboard.GlobalHotKeys gets called by accidental keypresses #324

Closed iiPythonx closed 3 years ago

iiPythonx commented 3 years ago

The title might not make sense, so let me elaborate further. I'm making a custom "windows search utility" in Python which uses the Space+S shortcut to operate, this works fine in pynput, but if I type something like gets called it also detects the keypress in the middle.

So my question, is there a way to set a maximum press time (or something of the sort), so that you have to press the keys in under lets say 0.5 seconds.

Thanks for any help.

moses-palmer commented 3 years ago

Thank you for your request.

The GlobalHotKeys class is intentionally simple; if you want more customised behaviour, I'm afraid that you will have to implement it yourself. #323 has a simple suggestion for timeouts.