-
Notifications
You must be signed in to change notification settings - Fork 428
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
suppress=True doesn't work with read_hotkey and on_release_key #635
Comments
After some more digging I realised that there's an open issue addressing the buggy implementation of key suppression (#22), and that a rewrite of the suppression system is underway in the As |
EDIT: This issue seems to have been resolved on the
new_core
branch. See #635 (comment)keyboard version: 0.13.5
OS: Windows 10 Pro 22H2
When calling
read_hotkey(suppress=True)
, the next key or key-chord is not being suppressed and is passing through to whatever window is active.The hotkey is still being read by the function correctly, just that the suppression of the key to the rest of the OS is not functioning.
suppress=True
is working correctly withread_event
,read_key
, andon_press_key
functions.The culprit seems to be the callback function passed to
hook
:keyboard/keyboard/__init__.py
Line 1069 in d232de0
specifically the part,
or e.event_type == KEY_DOWN
.If
KEY_DOWN
is changed toKEY_UP
(as inon_press_key
), then the next key or key-chord (e.g.,a
orctrl+h
) is suppressed correctly (obviously, however, this breaksread_hotkey
, preventing it from recording key-chords, and so isn't actually a solution).This issue could possibly be related to #596? Unfortunately, the workaround given in #596 doesn't seem possible with
read_hotkey
, as its callback needs to return the conditional check onKEY_DOWN
in order to function correctly, and can't be forced to always returnFalse
. I'm only a novice programmer though, so happy for someone to correct me on that if I'm wrong.The text was updated successfully, but these errors were encountered: