diff options
| author | nnyyxxxx <nnyyxxxx@protonmail.com> | 2025-02-21 13:35:10 -0500 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-26 03:32:21 -0800 |
| commit | 1bdded7a44ae002243cfae5a055607fa14820d73 (patch) | |
| tree | c1f1f948aa68693de39a0427536fe2a3479e8ab7 | |
| parent | 9bfe90dee1f5e54922b073a8a5a86e4ca25a5765 (diff) | |
| download | niri-1bdded7a44ae002243cfae5a055607fa14820d73.tar.gz niri-1bdded7a44ae002243cfae5a055607fa14820d73.tar.bz2 niri-1bdded7a44ae002243cfae5a055607fa14820d73.zip | |
feat(input): add off option to touch device
| -rw-r--r-- | niri-config/src/lib.rs | 3 | ||||
| -rw-r--r-- | src/input/mod.rs | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index ca7d3807..51693a94 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -349,6 +349,8 @@ pub struct Tablet { #[derive(knuffel::Decode, Debug, Default, PartialEq)] pub struct Touch { + #[knuffel(child)] + pub off: bool, #[knuffel(child, unwrap(argument))] pub map_to_output: Option<String>, } @@ -3900,6 +3902,7 @@ mod tests { left_handed: false, }, touch: Touch { + off: false, map_to_output: Some( "eDP-1", ), diff --git a/src/input/mod.rs b/src/input/mod.rs index 8f923473..51555a96 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -3512,6 +3512,16 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: let _ = device.config_left_handed_set(c.left_handed); } + + let is_touch = device.has_capability(input::DeviceCapability::Touch); + if is_touch { + let c = &config.touch; + let _ = device.config_send_events_set_mode(if c.off { + input::SendEventsMode::DISABLED + } else { + input::SendEventsMode::ENABLED + }); + } } pub fn mods_with_binds( |
