-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Tracking issueeframeRelates to epi and eframeRelates to epi and eframeeguigood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
The keyboard input in egui is limited in a couple of ways:
- Lots of keys missing from
Event::Key - We don't report the
super/metamodifier key - We don't report modifier key presses (just their state)
- Physical keys not reported on the eframe web backend
KeyboardShortcutshould ignoreshiftandaltkeys for logical keys (e.g.Ctrl Plusmay require pressing shift on some keyboards). See The keyboard shortcut of zoom in does not work on the JIS keyboard #3626 for more
How can I help?
- Look at the code for
egui::Keyand follow the instructions there for adding new keys - Investigate if we can get physical keycode on web
Requested keys
- Numpad
- Volume keys
- Curly brackets:
{and} - CapsLock (Caps Lock Key/Modifier #2041)
- Modifier keys
Prioir art
winit: https://docs.rs/winit/latest/winit/event/struct.KeyEvent.html- https://github.com/pyfisch/keyboard-types
Relevant issues
- Need to Distinguish Left and Right Keys for "Ctrl, Alt, Shift" on the Keyboard #3636
- The keyboard shortcut of zoom in does not work on the JIS keyboard #3626
- Issue with number key mapping #3415
- Need more key mappings #3372
- Add non-portable keys to egui::Key #3303
- Omitted keys prevent implementation of macOS standard shortcuts #3099
- Add more pressen keys to ctx.input #3094
- Forward
scancodesvia egui-winit #2977 - Caps Lock Key/Modifier #2041
- Universal clipboard shortcuts (
Ctrl+C/V/X) don't work with non-Latin keyboard layouts #4081
Physical vs Logical keys
- Partially fixed by Update to winit 0.29 #3649 (needs web support, if even possible?)
Consider someone owning a physical QWERTY keyboard:

However, they have remapped it to use Dvorak (perhaps even repainting the text on their keyboard):

If they start hitting Caps Lock and then moving to the left, the keys they will be hitting will be
- physical (qwerty): CapsLock, A, S, D, F, …
- logical (Dvorak): CapsLock, A, O, E, U …
The logical keys makes sense for most keyboard shortcuts - if you say "Press Cmd+S to save" in your UI, the user will be looking for the logical key "S"
The physical keys are mostly useful for games, where e.g. te physical WSAD on QWERTY moves a character, no matter what the users keymap is.
Kyza, Inspirateur and Skglandfeluxe and Inspirateur
Metadata
Metadata
Assignees
Labels
Tracking issueeframeRelates to epi and eframeRelates to epi and eframeeguigood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed