Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Add public custom keystroke resolver API #164

Merged
merged 3 commits into from
Oct 28, 2016

Conversation

nathansobo
Copy link
Contributor

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant