forge
Explore
Log in

Don't you dare go Hollow

add mod3 key binding support (#565)

Browse files at this commit

9728dbeeac39142cf9bec5d288495b29094654aeUnverifiedJeff PeelerParent: 324029c
* add support for iso_level5_shift modifier

* update Cargo.lock

bumps smithay to de94e8f59e202b605c35dfe1fef1857bad427e8c
Cargo.lockmodified+8 -17
@@ -2111,15 +2111,6 @@ version = "2.7.4"
2111 source = "registry+https://github.com/rust-lang/crates.io-index"2111 source = "registry+https://github.com/rust-lang/crates.io-index"
2112 checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"2112 checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
2113 2113
2114-[[package]]
2115-name = "memmap2"
2116-version = "0.8.0"
2117-source = "registry+https://github.com/rust-lang/crates.io-index"
2118-checksum = "43a5a03cefb0d953ec0be133036f14e109412fa594edc2f77227249db66cc3ed"
2119-dependencies = [
2120- "libc",
2121-]
2122-
2123 [[package]]2114 [[package]]
2124 name = "memmap2"2115 name = "memmap2"
2125 version = "0.9.4"2116 version = "0.9.4"
@@ -2403,7 +2394,7 @@ version = "0.7.2"
2403 source = "registry+https://github.com/rust-lang/crates.io-index"2394 source = "registry+https://github.com/rust-lang/crates.io-index"
2404 checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"2395 checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
2405 dependencies = [2396 dependencies = [
2406- "proc-macro-crate 3.1.0",2397+ "proc-macro-crate 1.3.1",
2407 "proc-macro2",2398 "proc-macro2",
2408 "quote",2399 "quote",
2409 "syn 2.0.72",2400 "syn 2.0.72",
@@ -3486,7 +3477,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
3486 [[package]]3477 [[package]]
3487 name = "smithay"3478 name = "smithay"
3488 version = "0.3.0"3479 version = "0.3.0"
3489-source = "git+https://github.com/Smithay/smithay.git#91bea4d1d20c1a59c48159994459ac86fc113607"3480+source = "git+https://github.com/Smithay/smithay.git#de94e8f59e202b605c35dfe1fef1857bad427e8c"
3490 dependencies = [3481 dependencies = [
3491 "appendlist",3482 "appendlist",
3492 "bitflags 2.6.0",3483 "bitflags 2.6.0",
@@ -3544,7 +3535,7 @@ dependencies = [
3544 "cursor-icon",3535 "cursor-icon",
3545 "libc",3536 "libc",
3546 "log",3537 "log",
3547- "memmap2 0.9.4",3538+ "memmap2",
3548 "rustix 0.38.34",3539 "rustix 0.38.34",
3549 "thiserror",3540 "thiserror",
3550 "wayland-backend",3541 "wayland-backend",
@@ -3560,7 +3551,7 @@ dependencies = [
3560 [[package]]3551 [[package]]
3561 name = "smithay-drm-extras"3552 name = "smithay-drm-extras"
3562 version = "0.1.0"3553 version = "0.1.0"
3563-source = "git+https://github.com/Smithay/smithay.git#91bea4d1d20c1a59c48159994459ac86fc113607"3554+source = "git+https://github.com/Smithay/smithay.git#de94e8f59e202b605c35dfe1fef1857bad427e8c"
3564 dependencies = [3555 dependencies = [
3565 "drm",3556 "drm",
3566 "edid-rs",3557 "edid-rs",
@@ -4649,7 +4640,7 @@ dependencies = [
4649 "dpi",4640 "dpi",
4650 "js-sys",4641 "js-sys",
4651 "libc",4642 "libc",
4652- "memmap2 0.9.4",4643+ "memmap2",
4653 "ndk",4644 "ndk",
4654 "objc2",4645 "objc2",
4655 "objc2-app-kit",4646 "objc2-app-kit",
@@ -4747,12 +4738,12 @@ dependencies = [
4747 4738
4748 [[package]]4739 [[package]]
4749 name = "xkbcommon"4740 name = "xkbcommon"
4750-version = "0.7.0"4741+version = "0.8.0"
4751 source = "registry+https://github.com/rust-lang/crates.io-index"4742 source = "registry+https://github.com/rust-lang/crates.io-index"
4752-checksum = "13867d259930edc7091a6c41b4ce6eee464328c6ff9659b7e4c668ca20d4c91e"4743+checksum = "8d66ca9352cbd4eecbbc40871d8a11b4ac8107cfc528a6e14d7c19c69d0e1ac9"
4753 dependencies = [4744 dependencies = [
4754 "libc",4745 "libc",
4755- "memmap2 0.8.0",4746+ "memmap2",
4756 "xkeysym",4747 "xkeysym",
4757 ]4748 ]
4758 4749
niri-config/src/lib.rsmodified+26 -6
@@ -1004,11 +1004,12 @@ bitflags! {
1004 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1004 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1005 pub struct Modifiers : u8 {1005 pub struct Modifiers : u8 {
1006 const CTRL = 1;1006 const CTRL = 1;
1007- const SHIFT = 2;1007+ const SHIFT = 1 << 1;
1008- const ALT = 4;1008+ const ALT = 1 << 2;
1009- const SUPER = 8;1009+ const SUPER = 1 << 3;
1010- const ISO_LEVEL3_SHIFT = 16;1010+ const ISO_LEVEL3_SHIFT = 1 << 4;
1011- const COMPOSITOR = 32;1011+ const ISO_LEVEL5_SHIFT = 1 << 5;
1012+ const COMPOSITOR = 1 << 6;
1012 }1013 }
1013 }1014 }
1014 1015
@@ -2509,6 +2510,10 @@ impl FromStr for Key {
2509 || part.eq_ignore_ascii_case("mod5")2510 || part.eq_ignore_ascii_case("mod5")
2510 {2511 {
2511 modifiers |= Modifiers::ISO_LEVEL3_SHIFT;2512 modifiers |= Modifiers::ISO_LEVEL3_SHIFT;
2513+ } else if part.eq_ignore_ascii_case("iso_level5_shift")
2514+ || part.eq_ignore_ascii_case("mod3")
2515+ {
2516+ modifiers |= Modifiers::ISO_LEVEL5_SHIFT;
2512 } else {2517 } else {
2513 return Err(miette!("invalid modifier: {part}"));2518 return Err(miette!("invalid modifier: {part}"));
2514 }2519 }
@@ -3275,7 +3280,7 @@ mod tests {
3275 }3280 }
3276 3281
3277 #[test]3282 #[test]
3278- fn parse_iso_level3_shift() {3283+ fn parse_iso_level_shifts() {
3279 assert_eq!(3284 assert_eq!(
3280 "ISO_Level3_Shift+A".parse::<Key>().unwrap(),3285 "ISO_Level3_Shift+A".parse::<Key>().unwrap(),
3281 Key {3286 Key {
@@ -3290,6 +3295,21 @@ mod tests {
3290 modifiers: Modifiers::ISO_LEVEL3_SHIFT3295 modifiers: Modifiers::ISO_LEVEL3_SHIFT
3291 },3296 },
3292 );3297 );
3298+
3299+ assert_eq!(
3300+ "ISO_Level5_Shift+A".parse::<Key>().unwrap(),
3301+ Key {
3302+ trigger: Trigger::Keysym(Keysym::a),
3303+ modifiers: Modifiers::ISO_LEVEL5_SHIFT
3304+ },
3305+ );
3306+ assert_eq!(
3307+ "Mod3+A".parse::<Key>().unwrap(),
3308+ Key {
3309+ trigger: Trigger::Keysym(Keysym::a),
3310+ modifiers: Modifiers::ISO_LEVEL5_SHIFT
3311+ },
3312+ );
3293 }3313 }
3294 3314
3295 #[test]3315 #[test]
src/input/mod.rsmodified+3 -0
@@ -2327,6 +2327,9 @@ fn modifiers_from_state(mods: ModifiersState) -> Modifiers {
2327 if mods.iso_level3_shift {2327 if mods.iso_level3_shift {
2328 modifiers |= Modifiers::ISO_LEVEL3_SHIFT;2328 modifiers |= Modifiers::ISO_LEVEL3_SHIFT;
2329 }2329 }
2330+ if mods.iso_level5_shift {
2331+ modifiers |= Modifiers::ISO_LEVEL5_SHIFT;
2332+ }
2330 modifiers2333 modifiers
2331 }2334 }
2332 2335
src/ui/hotkey_overlay.rsmodified+3 -0
@@ -403,6 +403,9 @@ fn key_name(comp_mod: CompositorMod, key: &Key) -> String {
403 if key.modifiers.contains(Modifiers::ISO_LEVEL3_SHIFT) {403 if key.modifiers.contains(Modifiers::ISO_LEVEL3_SHIFT) {
404 name.push_str("ISO_Level3_Shift + ");404 name.push_str("ISO_Level3_Shift + ");
405 }405 }
406+ if key.modifiers.contains(Modifiers::ISO_LEVEL5_SHIFT) {
407+ name.push_str("ISO_Level5_Shift + ");
408+ }
406 if key.modifiers.contains(Modifiers::SHIFT) {409 if key.modifiers.contains(Modifiers::SHIFT) {
407 name.push_str("Shift + ");410 name.push_str("Shift + ");
408 }411 }