From 498caa149f3adf612641e5a8bc8cb05982be015e Mon Sep 17 00:00:00 2001 From: Richard Acayan Date: Wed, 31 Jul 2024 17:01:29 -0400 Subject: [PATCH] core: layout: use uppercase label when pressing shift --- src/core/layout.rs | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/core/layout.rs b/src/core/layout.rs index ae8a854..848e6a3 100644 --- a/src/core/layout.rs +++ b/src/core/layout.rs @@ -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 { match orig_sym { @@ -286,6 +353,10 @@ impl Part { val = Self::modify_no_fn(&val); } + if mod_state[MOD_SHIFT - 1] != ModState::Released { + val = Self::modify_shift_label(&val); + } + self.val = val; }