Make ModTap into a tuple struct
This commit is contained in:
@ -26,7 +26,7 @@ impl From<Modifier> for u8 {
|
|||||||
pub enum Button {
|
pub enum Button {
|
||||||
Mod(Modifier),
|
Mod(Modifier),
|
||||||
Key(Key),
|
Key(Key),
|
||||||
ModTap { keycode: Key, modifier: Modifier },
|
ModTap(Key, Modifier),
|
||||||
NextLayer,
|
NextLayer,
|
||||||
PrevLayer,
|
PrevLayer,
|
||||||
None,
|
None,
|
||||||
@ -36,11 +36,28 @@ impl Display for Button {
|
|||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
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::NextLayer => write!(f, "↘"),
|
||||||
Button::PrevLayer => write!(f, "↖"),
|
Button::PrevLayer => write!(f, "↖"),
|
||||||
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}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user