Add off option to touch device
Browse files at this commit1bdded7a44ae002243cfae5a055607fa14820d73Parent: 9bfe90d- feat
- add off option to touch device
2 changed files +13 -0
- niri-config/src/lib.rs +3 -0
- src/input/mod.rs +10 -0
niri-config/src/lib.rsmodified+3 -0
| @@ -349,6 +349,8 @@ pub struct Tablet { | ||
| 349 | 349 | |
| 350 | 350 | #[derive(knuffel::Decode, Debug, Default, PartialEq)] |
| 351 | 351 | pub struct Touch { |
| 352 | + #[knuffel(child)] | |
| 353 | + pub off: bool, | |
| 352 | 354 | #[knuffel(child, unwrap(argument))] |
| 353 | 355 | pub map_to_output: Option<String>, |
| 354 | 356 | } |
| @@ -3900,6 +3902,7 @@ mod tests { | ||
| 3900 | 3902 | left_handed: false, |
| 3901 | 3903 | }, |
| 3902 | 3904 | touch: Touch { |
| 3905 | + off: false, | |
| 3903 | 3906 | map_to_output: Some( |
| 3904 | 3907 | "eDP-1", |
| 3905 | 3908 | ), |
src/input/mod.rsmodified+10 -0
| @@ -3512,6 +3512,16 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: | ||
| 3512 | 3512 | |
| 3513 | 3513 | let _ = device.config_left_handed_set(c.left_handed); |
| 3514 | 3514 | } |
| 3515 | + | |
| 3516 | + let is_touch = device.has_capability(input::DeviceCapability::Touch); | |
| 3517 | + if is_touch { | |
| 3518 | + let c = &config.touch; | |
| 3519 | + let _ = device.config_send_events_set_mode(if c.off { | |
| 3520 | + input::SendEventsMode::DISABLED | |
| 3521 | + } else { | |
| 3522 | + input::SendEventsMode::ENABLED | |
| 3523 | + }); | |
| 3524 | + } | |
| 3515 | 3525 | } |
| 3516 | 3526 | |
| 3517 | 3527 | pub fn mods_with_binds( |