Add some way to configure eguis build in shortcuts
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
Some applications might want to change the default shortcuts or override the behaviour. So we should have some way to change defaults, remove / add shortcuts for the built in actions. Maybe something like this:
```rs
type Shortcuts = SmallVec<[Shortcut;2]>
struct EguiShortcuts {
copy: Shortcuts,
paste: Shortcuts,
cut: Shortcuts,
click_focused: Shortcuts,
focus_next: Shortcuts,
focus_up: Shortcuts,
...
}
```
Ideally, once this is implemented there shouldn't be a single hardcoded `egui::Key` left in the egui repo.
Also, it would be great if shortcuts could have an `exact` flag, which should ensure that no _other_ modifiers are pressed.
That way, if a user wanted to do a custom `ctrl+tab` shortcut, they could set the focus_next (tab) shortcut to exact so they could query for the ctrl tab shortcut in the application code without conflicting.
Maybe eguis internal shortcut handling should also be moved to the end of frame, so that focused widgets have a chance to `consuome_shortcut` and override the global shortcut.
Related:
- https://github.com/emilk/egui/issues/5878
- https://github.com/emilk/egui/issues/4065
- https://github.com/emilk/egui/issues/3653
- https://github.com/emilk/egui/pull/5615
Contributor guide
Research direction
Start by reading related issues #5878, #4065, #3653 and pull request #5615, then trace egui's built-in shortcut handling. Done means the project has a decided, documented approach for configurable built-in shortcuts, exact modifier matching, and interaction between widget and global handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100