-
Notifications
You must be signed in to change notification settings - Fork 127
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
Question? Allow querying all keyboard shortcuts? #160
Comments
I don't think there's a solution to your problem with the current API. I had a similar problem, however, and to work around it I created a function which I use to register all my keys ( You can see the relevant functions here here: https://github.com/mafredri/phoenix-config/blob/master/src/key.ts#L31-L73 And for an example where I use it to re-enable the keys that got disabled: https://github.com/mafredri/phoenix-config/blob/master/src/scan.ts#L73-L81 Maybe not ideal, but I hope it can help you along the way 😄. |
This is somewhat related to #161. Internally, Phoenix does not keep track of the handlers. It’s all event based and I want to keep it that way. Yes, this could be exposed through managed handlers in the JavaScript-context, but that would expose the internal state of the handlers and would make it possible for the user to retain the value and this would mess the memory management. It’s better you implement this by managing handlers yourself for the specific use case. |
Thank you @kasper, now I took a look at the code, and it seems that enabling a key just registers a hotkey with the "exclusive" flag, and that automatically overwrites the previous hotkey. I apologize. The wording of the documentation (where it says that enabling one handler automatically disables the others) suggested to me that you kept track of all the handlers. Now I see it's not implemented like that. Yes, I now intend to write a |
@kemal and I are binding keys while a modal is visible. I guess that makes them modal keys? The problem is: if I have a global key, say Alt-Enter, and I bind that same combination in a "mode", then I have to make sure to re-enable the global version when the "mode" is "done".
The API doc says that enabling a handler automatically disables the other handlers for the same key/modifier combo, so I guess Phoenix already "knows" which handlers exist. So maybe if this information was exposed, then on entering the "mode" we could query for enabled handlers and then re-enable them when leaving the "mode".
Hope that wording makes sense, not sure if I've explained myself well.
The text was updated successfully, but these errors were encountered: