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

Keybindings flexibility across different keyboard layouts and languages #2636

Open
victorcrimea opened this issue Sep 26, 2023 · 0 comments
Open
Labels
C-feature Category: New feature or request

Comments

@victorcrimea
Copy link
Contributor

victorcrimea commented Sep 26, 2023

Is your feature request related to a problem? Please describe.

Keyboards have different:

  • physical (win, mac, ISO vs ANSI)
  • and logical
    • latin (US QWERTY, French AZERTY, German QWERTZ, dvorak, colemak)
    • non-latin (Greek, Russian, Georgian, Ukrainian, etc) layouts.

Which brings a lot confusing when defining keybindings in configuration files and binding interactively. Some top of the head problems:

  • When combination like ctrl+z is defined in configuration file and user has german layout. Is action triggered when user presses Control + Z(key in the bottom row) or Control + Z(key in the top row)?
  • It should be possible to define specific behavior for left/right modifier keys on the opt-in basis, while having both modifier keys behave identically by default. So separate actions for leftcontrol+s and rightcontrol+s. See Keybind: differentiate between left and right modifiers #2363
  • when control+z is defined in config it should also be triggered when user has non-latin layout, but presses control+[key which has latin Z on it] unless a layout-specific combination is defined too, so it overrides.

Describe the solution you'd like

keymaps.toml stores keybindings in virtualkey format supporting:

  • two-sided control alt shift meta (meta being universal for win and cmd keys too)
  • single-sided leftcontrol rightcontrol leftshift rightshift leftalt rightalt aka altgr
  • a - z 1 - 0
  • special characters like $, ~, * are also supported but should be used with caution, because they can be produced by different keys and unreachable combinations are very possible. So it is preferable to have control+shift+8 over control+* in default config in order to distinguish between numrow key 8 and numpad multiply.
  • Raw keycodes are also supported [KeyA] - [KeyZ] [KeyNumPadAdd] etc, as defined in winit::keyboard::KeyCode

In keymap settings when interactively entering a key combination there should be two chekboxes:

  • store as raw keycodes - nitty to avoid researching actual keycode to save keycode-based keybinding
  • account for left/right modifier (per each modifier) - to automatically save as leftcontrol+s if indeed combination was interactively provided with left control key.

Describe alternatives you've considered

  • Store all keybindings in raw keycodes - works well if user uses solely US Qwerty and other non-latin layout. If user uses alternative latin layout (dvorak, colemak) this brings a ton of problems.

Additional context

VSCode approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant