Compare commits
6 Commits
eb18dc9590
...
fonts
| Author | SHA1 | Date | |
|---|---|---|---|
|
98406dd0df
|
|||
|
0dc7eb6049
|
|||
|
c34c317f4e
|
|||
|
727e0bbd72
|
|||
|
903f880c73
|
|||
|
643f75cf0a
|
BIN
Cantarell-VF.otf
Normal file
BIN
Cantarell-VF.otf
Normal file
Binary file not shown.
BIN
IosevkaNerdFont-Medium.ttf
Normal file
BIN
IosevkaNerdFont-Medium.ttf
Normal file
Binary file not shown.
BIN
IosevkaNerdFont-Regular.ttf
Normal file
BIN
IosevkaNerdFont-Regular.ttf
Normal file
Binary file not shown.
BIN
IosevkaNerdFontMono-Regular.ttf
Normal file
BIN
IosevkaNerdFontMono-Regular.ttf
Normal file
Binary file not shown.
BIN
IosevkaNerdFontPropo-Medium.ttf
Normal file
BIN
IosevkaNerdFontPropo-Medium.ttf
Normal file
Binary file not shown.
BIN
NotoSans-Regular.ttf
Normal file
BIN
NotoSans-Regular.ttf
Normal file
Binary file not shown.
BIN
NotoSansMath-Regular.ttf
Normal file
BIN
NotoSansMath-Regular.ttf
Normal file
Binary file not shown.
BIN
NotoSansMono-Regular.ttf
Normal file
BIN
NotoSansMono-Regular.ttf
Normal file
Binary file not shown.
BIN
SourceCodePro-Regular.otf
Normal file
BIN
SourceCodePro-Regular.otf
Normal file
Binary file not shown.
@ -22,25 +22,83 @@ impl From<Modifier> for u8 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum Button {
|
pub enum Button {
|
||||||
Mod(Modifier),
|
Mod(Modifier),
|
||||||
Key(Key),
|
Key(Key),
|
||||||
ModTap { keycode: Key, modifier: Modifier },
|
ModTap(Key, Modifier),
|
||||||
NextLayer,
|
Compose2(CompShift, Key, CompShift, Key),
|
||||||
PrevLayer,
|
Compose3(CompShift, Key, CompShift, Key, CompShift, Key),
|
||||||
|
Layer(LayerShift, LayerDir, u16),
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether a key should be shift modified as part of a compose chain.
|
||||||
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
pub enum CompShift {
|
||||||
|
/// Do not shift the key.
|
||||||
|
#[default]
|
||||||
|
Lower,
|
||||||
|
|
||||||
|
/// Shift the key.
|
||||||
|
Upper,
|
||||||
|
|
||||||
|
/// Shift the key if shift is being held down.
|
||||||
|
Variable,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
pub enum LayerDir {
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
pub enum LayerShift {
|
||||||
|
Move,
|
||||||
|
Peek,
|
||||||
|
}
|
||||||
|
|
||||||
impl Display for Button {
|
impl Display for Button {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
let cs = |cs: &CompShift| match cs {
|
||||||
|
CompShift::Lower => "",
|
||||||
|
CompShift::Upper => "⇧",
|
||||||
|
CompShift::Variable => "⇧?",
|
||||||
|
};
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Button::Mod(modifier) => Debug::fmt(&modifier, f),
|
Button::Mod(modifier) => Debug::fmt(&modifier, f),
|
||||||
Button::Key(keycode) => write!(f, "{keycode:?}"),
|
Button::Key(key) => write!(f, "{key:?}"),
|
||||||
Button::ModTap { keycode, modifier } => write!(f, "{keycode:?}/{modifier:?}"),
|
Button::ModTap(key, modifier) => write!(f, "{key:?}/{modifier}"),
|
||||||
Button::NextLayer => write!(f, "↘"),
|
Button::Compose2(cs1, k1, cs2, k2) => {
|
||||||
Button::PrevLayer => write!(f, "↖"),
|
write!(f, "⎄ {}{k1:?} {}{k2:?}", cs(cs1), cs(cs2))
|
||||||
|
}
|
||||||
|
Button::Compose3(cs1, k1, cs2, k2, cs3, k3) => {
|
||||||
|
write!(f, "⎄ {}{k1:?} {}{k2:?} {}{k3:?}", cs(cs1), cs(cs2), cs(cs3))
|
||||||
|
}
|
||||||
|
Button::Layer(..) => write!(f, "Lr"),
|
||||||
Button::None => write!(f, "Ø"),
|
Button::None => write!(f, "Ø"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for Modifier {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
let s = match self {
|
||||||
|
Modifier::LCtrl => "⎈",
|
||||||
|
Modifier::LShift => "⇧",
|
||||||
|
Modifier::LAlt => "⎇",
|
||||||
|
Modifier::LMod => "◆",
|
||||||
|
Modifier::RCtrl => "⎈",
|
||||||
|
Modifier::RShift => "⇧",
|
||||||
|
Modifier::RAlt => "⎇",
|
||||||
|
Modifier::RMod => "◆",
|
||||||
|
};
|
||||||
|
|
||||||
|
write!(f, "{s}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
// https://usb.org/sites/default/files/hut1_3_0.pdf
|
// https://usb.org/sites/default/files/hut1_3_0.pdf
|
||||||
pub enum Key {
|
pub enum Key {
|
||||||
A = 0x04,
|
A = 0x04,
|
||||||
|
|||||||
Reference in New Issue
Block a user