core: layout: use uppercase label when pressing shift

This commit is contained in:
Richard Acayan 2024-07-31 17:01:29 -04:00
parent b378240a38
commit 498caa149f

View file

@ -113,6 +113,73 @@ impl Part {
} }
} }
fn modify_shift_label(orig_sym: &KeyValue) -> KeyValue
{
match orig_sym {
KeyValue(Keysym::a, _)
=> KeyValue::from(Keysym::a, "A"),
KeyValue(Keysym::b, _)
=> KeyValue::from(Keysym::b, "B"),
KeyValue(Keysym::c, _)
=> KeyValue::from(Keysym::c, "C"),
KeyValue(Keysym::d, _)
=> KeyValue::from(Keysym::d, "D"),
KeyValue(Keysym::e, _)
=> KeyValue::from(Keysym::e, "E"),
KeyValue(Keysym::f, _)
=> KeyValue::from(Keysym::f, "F"),
KeyValue(Keysym::g, _)
=> KeyValue::from(Keysym::g, "G"),
KeyValue(Keysym::h, _)
=> KeyValue::from(Keysym::h, "H"),
KeyValue(Keysym::i, _)
=> KeyValue::from(Keysym::i, "I"),
KeyValue(Keysym::j, _)
=> KeyValue::from(Keysym::j, "J"),
KeyValue(Keysym::k, _)
=> KeyValue::from(Keysym::k, "K"),
KeyValue(Keysym::l, _)
=> KeyValue::from(Keysym::l, "L"),
KeyValue(Keysym::m, _)
=> KeyValue::from(Keysym::m, "M"),
KeyValue(Keysym::n, _)
=> KeyValue::from(Keysym::n, "N"),
KeyValue(Keysym::o, _)
=> KeyValue::from(Keysym::o, "O"),
KeyValue(Keysym::p, _)
=> KeyValue::from(Keysym::p, "P"),
KeyValue(Keysym::q, _)
=> KeyValue::from(Keysym::q, "Q"),
KeyValue(Keysym::r, _)
=> KeyValue::from(Keysym::r, "R"),
KeyValue(Keysym::s, _)
=> KeyValue::from(Keysym::s, "S"),
KeyValue(Keysym::t, _)
=> KeyValue::from(Keysym::t, "T"),
KeyValue(Keysym::u, _)
=> KeyValue::from(Keysym::u, "U"),
KeyValue(Keysym::v, _)
=> KeyValue::from(Keysym::v, "V"),
KeyValue(Keysym::w, _)
=> KeyValue::from(Keysym::w, "W"),
KeyValue(Keysym::x, _)
=> KeyValue::from(Keysym::x, "X"),
KeyValue(Keysym::y, _)
=> KeyValue::from(Keysym::y, "Y"),
KeyValue(Keysym::z, _)
=> KeyValue::from(Keysym::z, "Z"),
KeyValue(Keysym::ae, _)
=> KeyValue::from(Keysym::ae, "Æ"),
KeyValue(Keysym::oe, _)
=> KeyValue::from(Keysym::oe, "Œ"),
KeyValue(Keysym::mu, _)
=> KeyValue::from(Keysym::mu, "Μ"),
_ => orig_sym.clone(),
}
}
fn modify_fn(orig_sym: &KeyValue) -> KeyValue fn modify_fn(orig_sym: &KeyValue) -> KeyValue
{ {
match orig_sym { match orig_sym {
@ -286,6 +353,10 @@ impl Part {
val = Self::modify_no_fn(&val); val = Self::modify_no_fn(&val);
} }
if mod_state[MOD_SHIFT - 1] != ModState::Released {
val = Self::modify_shift_label(&val);
}
self.val = val; self.val = val;
} }