Skip to content
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

add_hotkey doesn't 'catch' keyboard event. #28

Closed
mibli opened this issue Nov 16, 2016 · 2 comments
Closed

add_hotkey doesn't 'catch' keyboard event. #28

mibli opened this issue Nov 16, 2016 · 2 comments

Comments

@mibli
Copy link

mibli commented Nov 16, 2016

Basically, when I use add_hotkey to register a hotkey, I would expect it to receive the event and stop it from being passed over.
Although I'm not sure if its an issue, but I can't find anything about it in the README.

@boppreh
Copy link
Owner

boppreh commented Nov 16, 2016

This is mentioned in the README as "key suppression". I opened an issue to track progress on it: #22 .

There are three major complications.

  1. Linux events are emitted after-the-fact, so there's nothing we can do to suppress it. Any solution here will require radically changing the way Linux events are captured, possibly requiring special code for each environment (console, X, Wayland).
  2. Even when we can technically suppress events (Windows makes it easy, for example), there's input lag. Python is not a fast language, and power users may be registering hundreds of hotkeys. We must assure they will all be processed in no more than a couple of milliseconds, otherwise the user starts experiencing uncomfortable delays when typing.
  3. What happens if one hotkey is contained in another? If I register ctrl+a and ctrl+a, space, what should happen? Should we block the event to see if the next key is a space (tremendous input lag)? Should the second hotkey never be triggered (would require some sort of warning)? It's not an easy problem.

I really want to support this. But it's not easy.

@boppreh
Copy link
Owner

boppreh commented Nov 16, 2016

Also, I'm closing this issue to avoid duplication. But thank you for your feedback, I hope this answer your question. I'll update the README to make clearer the equivalence "key suppression" = "event blocking" = "catching".

@boppreh boppreh closed this as completed Nov 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants