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
Feature Request: non-global / focus-only shortcuts #2482
Comments
@adam-lynch You can bind to events when the app is focused like you would in a normal HTML/JS application. Take a look at these:
Or if you use something like jQuery there are a few different ways to approach that. |
@Blazedd I don't think that answers what I'm looking for 😄. Plus the following is basically the same as checking in the callback like I said originally:
I'm saying maybe it's better that node-webkit wouldn't catch the keys at all when the app isn't focused. |
@adam-lynch The whole point of the shortcut events is allow the app to capture the events globally. Otherwise you can use the methods above to check that. Optionally you can check if the window is focused when you bind to your shortcut as well. Are you looking for an easy way to bind to specific key binding? The keydown doesn't give you a verbose "CTRL+A" setup, but there are libraries that do. I don't understand what you are needing that isn't already available. |
@Blazedd I understand how to bind key events, etc. It's not that it's technically impossible as is, I'm simply asking for the option to not make the shortcuts global, as a built-in option in the shortcuts API. If you don't want it, that's ok. It would be handy. Otherwise, let's say you don't know how many windows will be open at once. You then need to:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
It would be great if when assigning shortcuts, that we could pass
global: false
or something so theactive
callback would only be called if the app is focused.I guess we could check ourselves if the app is focused, but maybe it would more efficient not to catch the keys at all when the app is blurred on a lower level?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: