aboutsummaryrefslogtreecommitdiff
path: root/niri-config/src
diff options
context:
space:
mode:
authorJeff Peeler <jpeeler@gmail.com>2024-07-31 11:00:35 -0400
committerGitHub <noreply@github.com>2024-07-31 15:00:35 +0000
commit9728dbeeac39142cf9bec5d288495b29094654ae (patch)
treec129bb5797c2118ef17a61bb5e035118bd7259da /niri-config/src
parent324029ca3b23c9de44323645ac2edb606d5c099a (diff)
downloadniri-9728dbeeac39142cf9bec5d288495b29094654ae.tar.gz
niri-9728dbeeac39142cf9bec5d288495b29094654ae.tar.bz2
niri-9728dbeeac39142cf9bec5d288495b29094654ae.zip
add mod3 key binding support (#565)
* add support for iso_level5_shift modifier * update Cargo.lock bumps smithay to de94e8f59e202b605c35dfe1fef1857bad427e8c
Diffstat (limited to 'niri-config/src')
-rw-r--r--niri-config/src/lib.rs32
1 files changed, 26 insertions, 6 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index 9bb774f6..cfc8cb18 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -1004,11 +1004,12 @@ bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Modifiers : u8 {
const CTRL = 1;
- const SHIFT = 2;
- const ALT = 4;
- const SUPER = 8;
- const ISO_LEVEL3_SHIFT = 16;
- const COMPOSITOR = 32;
+ const SHIFT = 1 << 1;
+ const ALT = 1 << 2;
+ const SUPER = 1 << 3;
+ const ISO_LEVEL3_SHIFT = 1 << 4;
+ const ISO_LEVEL5_SHIFT = 1 << 5;
+ const COMPOSITOR = 1 << 6;
}
}
@@ -2509,6 +2510,10 @@ impl FromStr for Key {
|| part.eq_ignore_ascii_case("mod5")
{
modifiers |= Modifiers::ISO_LEVEL3_SHIFT;
+ } else if part.eq_ignore_ascii_case("iso_level5_shift")
+ || part.eq_ignore_ascii_case("mod3")
+ {
+ modifiers |= Modifiers::ISO_LEVEL5_SHIFT;
} else {
return Err(miette!("invalid modifier: {part}"));
}
@@ -3275,7 +3280,7 @@ mod tests {
}
#[test]
- fn parse_iso_level3_shift() {
+ fn parse_iso_level_shifts() {
assert_eq!(
"ISO_Level3_Shift+A".parse::<Key>().unwrap(),
Key {
@@ -3290,6 +3295,21 @@ mod tests {
modifiers: Modifiers::ISO_LEVEL3_SHIFT
},
);
+
+ assert_eq!(
+ "ISO_Level5_Shift+A".parse::<Key>().unwrap(),
+ Key {
+ trigger: Trigger::Keysym(Keysym::a),
+ modifiers: Modifiers::ISO_LEVEL5_SHIFT
+ },
+ );
+ assert_eq!(
+ "Mod3+A".parse::<Key>().unwrap(),
+ Key {
+ trigger: Trigger::Keysym(Keysym::a),
+ modifiers: Modifiers::ISO_LEVEL5_SHIFT
+ },
+ );
}
#[test]