-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scan Codes Not Unique? #171
Comments
In this case I blame the operating system for reporting two separate physical keys with the same scan code. Windows has "virtual key codes", and these keys do indeed report separate values. You could hack something yourself with that, but the concept is not completely portable. I plan to add support for numpad keys in the future, so you could |
Well obviously we can distinguish the two events in the context of adding a hotkey, because the events also carry the In terms of sending, I'm not too familiar but again there's a clear difference, so if we could just set the |
Yes, the feature I'm looking to add is the ability of hotkey listeners to check the numpad flag. For sending, however, things are more complicated. The numpad flag is derived from a list of signals; it's not an OS information. If you are on Windows, I suggest taking a look into the code that sends events. It's just a couple of lines long, and you can tweak to provide your own virtual key code, which does differentiate the two inserts correctly. I know it's not ideal, but it's an easy way to fix your problem. |
Ah, one more thing. Due to a variety of situations where Windows does something dumb (e.g. scan code = 0), the library is capable of sending raw virtual key codes if you provide a negative number for the scan code. So 'send(-72)' will send an event for virtual key code 72, not scan code. You just have to check what are the virtual key codes for the keys you want. |
I will look into that, thanks for the rapid feedback. |
Since this issue, I've switched to using scan codes for all hotkey-related things. Things were going smoothly until...
How do I distinguish between keys with the same
"scan_code"
but different"is_keypad"
values inkeyboard.add_hotkey()
andkeyboard.send()
?The text was updated successfully, but these errors were encountered: