gpui_platform/
keyboard.rs1use collections::HashMap;
4use gpui_types::{KeybindingKeystroke, Keystroke};
5
6pub trait PlatformKeyboardLayout {
8 fn id(&self) -> &str;
10 fn name(&self) -> &str;
12}
13
14pub trait PlatformKeyboardMapper {
16 fn map_key_equivalent(
18 &self,
19 keystroke: Keystroke,
20 use_key_equivalents: bool,
21 ) -> KeybindingKeystroke;
22 fn get_key_equivalents(&self) -> Option<&HashMap<char, char>>;
25}
26
27pub struct DummyKeyboardMapper;
29
30impl PlatformKeyboardMapper for DummyKeyboardMapper {
31 fn map_key_equivalent(
32 &self,
33 keystroke: Keystroke,
34 _use_key_equivalents: bool,
35 ) -> KeybindingKeystroke {
36 KeybindingKeystroke::from_keystroke(keystroke)
37 }
38
39 fn get_key_equivalents(&self) -> Option<&HashMap<char, char>> {
40 None
41 }
42}