gpui/platform/
keyboard.rs1use collections::HashMap;
2
3use crate::{KeybindingKeystroke, Keystroke};
4
5pub trait PlatformKeyboardLayout {
7 fn id(&self) -> &str;
9 fn name(&self) -> &str;
11}
12
13pub trait PlatformKeyboardMapper {
15 fn map_key_equivalent(
17 &self,
18 keystroke: Keystroke,
19 use_key_equivalents: bool,
20 ) -> KeybindingKeystroke;
21 fn get_key_equivalents(&self) -> Option<&HashMap<char, char>>;
24}
25
26pub struct DummyKeyboardMapper;
28
29impl PlatformKeyboardMapper for DummyKeyboardMapper {
30 fn map_key_equivalent(
31 &self,
32 keystroke: Keystroke,
33 _use_key_equivalents: bool,
34 ) -> KeybindingKeystroke {
35 KeybindingKeystroke::from_keystroke(keystroke)
36 }
37
38 fn get_key_equivalents(&self) -> Option<&HashMap<char, char>> {
39 None
40 }
41}