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 a guide to keyboard shortcuts #8775

Merged
merged 5 commits into from Feb 27, 2017
Merged

add a guide to keyboard shortcuts #8775

merged 5 commits into from Feb 27, 2017

Conversation

zeke
Copy link
Contributor

@zeke zeke commented Feb 26, 2017

An attendee at today's Electron Workshop in SF asked about how to set up keyboard shortcuts in Electron apps. This PR is an attempt to document the various options.

@zeke
Copy link
Contributor Author

zeke commented Feb 26, 2017

Hey @felixrieseberg I don't remember the names of the folks that were asking me about shortcuts today. If you're planning to email the attendees again, maybe you can add this PR as a footnote. :)

@enlight
Copy link
Contributor

enlight commented Feb 26, 2017

@zeke What do you think about swapping the order of the global & local sections? I'd like to encourage use of local shortcuts whenever possible.

@zeke
Copy link
Contributor Author

zeke commented Feb 26, 2017

swapping the order of the global & local sections

Done.


If you want to configure a local keyboard shortcut to trigger an action that
_does not_ have a corresponding menu item, you can use the
[electron-localshortcut] npm module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced on recommending this (I can't find the last comment I made about it). It's a cool trick but what it's doing behind the scenes is registering a global shortcut on focus and unregistering on blur.

This can lead to unknown side affects in other applications as lets say program X not based on Chromium has a global shortcut for "Control + Alt + Z", if you register a local shortcut through this module for the same combination then program X won't receive the global keypresses. This isn't the only possible side-affect but an easy one to explain.

Whereas if you use mousetrap in a per-window style thing as mentioned below you don't have this problem. Local shortcuts IMO shouldn't interfere with other global shortcuts and this module causes them to. Perhaps it's something that should be discussed or we need to add an enhancement issue for adding first party local shortcuts based on the Accelerator class (I spiked this at one point but it seemed very resource intensive the way I did it).

@zeke
Copy link
Contributor Author

zeke commented Feb 27, 2017

Thanks for the info, @MarshallOfSound. Removed the module recommendation.

@zeke zeke merged commit 5a17396 into master Feb 27, 2017
@zeke zeke deleted the shortcuts branch February 27, 2017 17:48
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

Successfully merging this pull request may close these issues.

None yet

4 participants