feat(input): add off option to touch device

This commit is contained in:
nnyyxxxx
2025-02-21 13:35:10 -05:00
committed by Ivan Molodetskikh
parent 9bfe90dee1
commit 1bdded7a44
2 changed files with 13 additions and 0 deletions
+3
View File
@@ -349,6 +349,8 @@ pub struct Tablet {
#[derive(knuffel::Decode, Debug, Default, PartialEq)] #[derive(knuffel::Decode, Debug, Default, PartialEq)]
pub struct Touch { pub struct Touch {
#[knuffel(child)]
pub off: bool,
#[knuffel(child, unwrap(argument))] #[knuffel(child, unwrap(argument))]
pub map_to_output: Option<String>, pub map_to_output: Option<String>,
} }
@@ -3900,6 +3902,7 @@ mod tests {
left_handed: false, left_handed: false,
}, },
touch: Touch { touch: Touch {
off: false,
map_to_output: Some( map_to_output: Some(
"eDP-1", "eDP-1",
), ),
+10
View File
@@ -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 _ = 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( pub fn mods_with_binds(