Skip to repository content42 lines · 1.2 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T06:49:59.066Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
keyboard.rs
1use collections::HashMap;
2
3use crate::{KeybindingKeystroke, Keystroke};
4
5/// A trait for platform-specific keyboard layouts
6pub trait PlatformKeyboardLayout {
7 /// Get the keyboard layout ID, which should be unique to the layout
8 fn id(&self) -> &str;
9 /// Get the keyboard layout display name
10 fn name(&self) -> &str;
11}
12
13/// A trait for platform-specific keyboard mappings
14pub trait PlatformKeyboardMapper {
15 /// Map a key equivalent to its platform-specific representation
16 fn map_key_equivalent(
17 &self,
18 keystroke: Keystroke,
19 use_key_equivalents: bool,
20 ) -> KeybindingKeystroke;
21 /// Get the key equivalents for the current keyboard layout,
22 /// only used on macOS
23 fn get_key_equivalents(&self) -> Option<&HashMap<char, char>>;
24}
25
26/// A dummy implementation of the platform keyboard mapper
27pub 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}
42