Compare commits

...

5 Commits

Author SHA1 Message Date
98406dd0df Add some fonts 2024-02-16 13:40:53 +01:00
0dc7eb6049 Tweak Compose button 2024-02-08 15:33:41 +01:00
c34c317f4e Make Layer shifting two-dimensional 2023-08-28 13:53:24 +02:00
727e0bbd72 Add HoldLayer button 2023-06-12 17:52:42 +02:00
903f880c73 Add compose macro button 2023-05-16 23:41:18 +02:00
11 changed files with 47 additions and 5 deletions

BIN
Cantarell-VF.otf Normal file

Binary file not shown.

BIN
IosevkaNerdFont-Medium.ttf Normal file

Binary file not shown.

BIN
IosevkaNerdFont-Regular.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
NotoSans-Regular.ttf Normal file

Binary file not shown.

BIN
NotoSansMath-Regular.ttf Normal file

Binary file not shown.

BIN
NotoSansMono-Regular.ttf Normal file

Binary file not shown.

BIN
SourceCodePro-Regular.otf Normal file

Binary file not shown.

View File

@ -22,24 +22,65 @@ impl From<Modifier> for u8 {
}
}
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum Button {
Mod(Modifier),
Key(Key),
ModTap(Key, Modifier),
NextLayer,
PrevLayer,
Compose2(CompShift, Key, CompShift, Key),
Compose3(CompShift, Key, CompShift, Key, CompShift, Key),
Layer(LayerShift, LayerDir, u16),
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 {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let cs = |cs: &CompShift| match cs {
CompShift::Lower => "",
CompShift::Upper => "",
CompShift::Variable => "⇧?",
};
match self {
Button::Mod(modifier) => Debug::fmt(&modifier, f),
Button::Key(key) => write!(f, "{key:?}"),
Button::ModTap(key, modifier) => write!(f, "{key:?}/{modifier}"),
Button::NextLayer => write!(f, ""),
Button::PrevLayer => write!(f, ""),
Button::Compose2(cs1, k1, cs2, k2) => {
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, "Ø"),
}
}

View File

@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
// https://usb.org/sites/default/files/hut1_3_0.pdf
pub enum Key {
A = 0x04,