-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: let callback signal to KeyAction::Allow
the keypress
#4
Comments
This is definitely needed, I plan on having a pause feature implemented in the next release 👍 |
Pause sounds good, but without the ability to keep a keybinding active I won't be able to let users unpause. For that I think I need the client code to be able to signal whether the key should get its normal processing or not. Do you have plans for that as well? I can think of a couple of ways to do it, such as a magic return type that win-hotkeys specializes on for the callback, or a mutable parameter to the callback. If not then I'll proceed with reorganizing my client to unregister/re-register on focus change or similar. Which is fine, certainly, but this seemed like a useful facility for clients to have, so I thought I'd ask! |
My current plan is to implement a pause handle. You can add the pause handle to the callback of a hotkey or use it independently. Calling toggle_pause on the handle will pause processing of any hotkeys other than the specified pause/unpause hotkey(s). Which would have the effect that I think you are looking for |
Oh excellent! I'll watch for that change, and please let me know if you want me to test anything in progress. Thanks again for this great work. |
I want to contextually determine in my app logic whether a hotkey applies, such as
Currently, these require unregistering and reregistering hotkeys at each state change, which is a bit clumsy, and the logic to allow normal key action processing seems like it would be straightforward given a way for the callback to communicate that desire.
What do you think of a way for the callback to signal that the key action should be allowed instead of blocked?
Thanks for a delightfully clean and simple crate!
The text was updated successfully, but these errors were encountered: