From 1bdded7a44ae002243cfae5a055607fa14820d73 Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Fri, 21 Feb 2025 13:35:10 -0500 Subject: feat(input): add off option to touch device --- niri-config/src/lib.rs | 3 +++ src/input/mod.rs | 10 ++++++++++ 2 files changed, 13 insertions(+) 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, } @@ -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( -- cgit