kbd-egui
kbd bridge for egui — converts key events and modifiers to kbd types.
This lets GUI key events (from egui) and global hotkey events (from kbd-global) feed into the same Dispatcher. Useful in egui apps that want both in-window shortcuts and system-wide hotkeys handled through a single hotkey registry.
Egui has a smaller, custom key enum that is not 1:1 with the W3C specification — some egui keys are logical/shifted characters without a single physical key equivalent (e.g., Colon, Pipe, Plus), and those return None.
[]
= "0.1"
= "0.1"
Extension traits
EguiKeyExt— converts anegui::Keyto akbd::key::KeyEguiModifiersExt— convertsegui::Modifiersto aVec<Modifier>EguiEventExt— converts a fullegui::Eventkeyboard event to akbd::hotkey::Hotkey
Usage
use ;
use *;
use ;
let key = A.to_key;
assert_eq!;
let event = Key ;
let hotkey = event.to_hotkey;
assert_eq!;
Key mapping
| egui | kbd | Notes |
|---|---|---|
Key::A – Key::Z |
Key::A – Key::Z |
Letters |
Key::Num0 – Key::Num9 |
Key::DIGIT0 – Key::DIGIT9 |
Digits |
Key::F1 – Key::F35 |
Key::F1 – Key::F35 |
Function keys |
Key::Minus, Key::Period, … |
Key::MINUS, Key::PERIOD, … |
Physical-position punctuation |
Key::ArrowDown, Key::Enter, … |
Key::ARROW_DOWN, Key::ENTER, … |
Navigation / editing |
Key::Copy, Key::Cut, Key::Paste |
Key::COPY, Key::CUT, Key::PASTE |
Clipboard |
Key::Colon, Key::Pipe, Key::Plus, … |
None |
Logical/shifted — no single physical key |
Modifier mapping
| egui | kbd | Notes |
|---|---|---|
ctrl |
Modifier::Ctrl |
|
shift |
Modifier::Shift |
|
alt |
Modifier::Alt |
|
mac_cmd |
Modifier::Super |
Avoids double-counting with command on macOS |
License
kbd-egui is licensed under the MIT license. See the LICENSE file for more information.