diff options
| author | Andreas Stührk <andy@hammerhartes.de> | 2024-03-22 22:09:25 +0100 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-23 15:45:27 +0400 |
| commit | d120e0c45142251b7c59b3a36f9bda709a58095e (patch) | |
| tree | 950da800bfba1e559e9be029f8830ac1ee9dd474 | |
| parent | 0f724f20116dd5b013f797521bb53649e7eeb3ed (diff) | |
| download | niri-d120e0c45142251b7c59b3a36f9bda709a58095e.tar.gz niri-d120e0c45142251b7c59b3a36f9bda709a58095e.tar.bz2 niri-d120e0c45142251b7c59b3a36f9bda709a58095e.zip | |
input: Add support for ISO level3 shift modifier
This modifier is typically called "AltGr" on keyboards or "Mod5" in xkb
layouts. Requires a Smithay update.
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | niri-config/src/lib.rs | 25 | ||||
| -rw-r--r-- | src/input.rs | 3 |
3 files changed, 29 insertions, 3 deletions
@@ -3088,7 +3088,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/Smithay/smithay.git#e61db794643190d4628fbb045634827e4619ffdf" +source = "git+https://github.com/Smithay/smithay.git#e5f006818df7ebb92d206985f45e713ba1e9c1c9" dependencies = [ "appendlist", "bitflags 2.4.2", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "smithay-drm-extras" version = "0.1.0" -source = "git+https://github.com/Smithay/smithay.git#e61db794643190d4628fbb045634827e4619ffdf" +source = "git+https://github.com/Smithay/smithay.git#e5f006818df7ebb92d206985f45e713ba1e9c1c9" dependencies = [ "drm", "edid-rs", diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 39b1f7f5..4e43d795 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -746,7 +746,8 @@ bitflags! { const SHIFT = 2; const ALT = 4; const SUPER = 8; - const COMPOSITOR = 16; + const ISO_LEVEL3_SHIFT = 16; + const COMPOSITOR = 32; } } @@ -1542,6 +1543,10 @@ impl FromStr for Key { modifiers |= Modifiers::ALT; } else if part.eq_ignore_ascii_case("super") || part.eq_ignore_ascii_case("win") { modifiers |= Modifiers::SUPER; + } else if part.eq_ignore_ascii_case("iso_level3_shift") + || part.eq_ignore_ascii_case("mod5") + { + modifiers |= Modifiers::ISO_LEVEL3_SHIFT; } else { return Err(miette!("invalid modifier: {part}")); } @@ -2087,4 +2092,22 @@ mod tests { assert!("-".parse::<SizeChange>().is_err()); assert!("10% ".parse::<SizeChange>().is_err()); } + + #[test] + fn parse_iso_level3_shift() { + assert_eq!( + "ISO_Level3_Shift+A".parse::<Key>().unwrap(), + Key { + trigger: Trigger::Keysym(Keysym::a), + modifiers: Modifiers::ISO_LEVEL3_SHIFT + }, + ); + assert_eq!( + "Mod5+A".parse::<Key>().unwrap(), + Key { + trigger: Trigger::Keysym(Keysym::a), + modifiers: Modifiers::ISO_LEVEL3_SHIFT + }, + ); + } } diff --git a/src/input.rs b/src/input.rs index c4558cee..f84d85f1 100644 --- a/src/input.rs +++ b/src/input.rs @@ -1849,6 +1849,9 @@ fn find_configured_bind( if mods.logo { modifiers |= Modifiers::SUPER; } + if mods.iso_level3_shift { + modifiers |= Modifiers::ISO_LEVEL3_SHIFT; + } let (mod_down, comp_mod) = match comp_mod { CompositorMod::Super => (mods.logo, Modifiers::SUPER), |
