Add public custom keystroke resolver API #164

Merged
merged 3 commits into from Oct 28, 2016

Conversation

Projects
None yet
1 participant
@nathansobo
Contributor

nathansobo commented Oct 28, 2016

@atom/maintainers I thought I'd make you aware of this API since it may be useful to suggest to users experiencing weird edge cases with keystroke resolution. I plan to hotfix it to 1.12-releases to ensure there's a fallback strategy for any remaining keyboard layout issues we may have missed with the internationalization improvements.

Rationale

There are quite a few Chrome bugs related to keyboard events on Linux. In addition, user expectations sometimes differ from our default behavior with respect to how we should interpret modifier keys on international keyboards. Finally, there are special modifier keys and crazy layouts on Linux that we don't have time to support right now.

Keystroke resolvers

The solution to all these problems and more is to allow users or packages to insert custom logic for resolving certain keyboard events to keystroke strings. When this PR lands, you'll be able to do something like the following.

atom.keymaps.addKeystrokeResolver(({event}) => {
  if (event.code === 'KeyG' && event.altKey && event.ctrlKey) {
    return 'ctrl-@'
  }
})

See the API documentation for more details.

@nathansobo nathansobo merged commit 382f774 into master Oct 28, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@nathansobo nathansobo deleted the ns-custom-keystroke-resolvers branch Oct 28, 2016

@nathansobo nathansobo referenced this pull request in atom/atom Nov 1, 2016

Closed

Incorrect keystroke resolution on Linux when ctrl modifier is used #12951

6 of 6 tasks complete

@Ben3eeE Ben3eeE referenced this pull request in atom/atom Nov 2, 2016

Closed

Keybindings with [ or ] do not work as expected on azerty layout #13131

6 of 6 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment