Allow disabling tap-and-drag (#1107)
Browse files at this commit4 changed files +16 -0
- niri-config/src/lib.rs +6 -0
- resources/default-config.kdl +1 -0
- src/input/mod.rs +7 -0
- wiki/Configuration:-Input.md +2 -0
niri-config/src/lib.rsmodified+6 -0
| @@ -185,6 +185,8 @@ pub struct Touchpad { | ||
| 185 | 185 | pub dwt: bool, |
| 186 | 186 | #[knuffel(child)] |
| 187 | 187 | pub dwtp: bool, |
| 188 | + #[knuffel(child, unwrap(argument))] | |
| 189 | + pub drag: Option<bool>, | |
| 188 | 190 | #[knuffel(child)] |
| 189 | 191 | pub drag_lock: bool, |
| 190 | 192 | #[knuffel(child)] |
| @@ -3553,6 +3555,7 @@ mod tests { | ||
| 3553 | 3555 | tap |
| 3554 | 3556 | dwt |
| 3555 | 3557 | dwtp |
| 3558 | + drag true | |
| 3556 | 3559 | click-method "clickfinger" |
| 3557 | 3560 | accel-speed 0.2 |
| 3558 | 3561 | accel-profile "flat" |
| @@ -3811,6 +3814,9 @@ mod tests { | ||
| 3811 | 3814 | tap: true, |
| 3812 | 3815 | dwt: true, |
| 3813 | 3816 | dwtp: true, |
| 3817 | + drag: Some( | |
| 3818 | + true, | |
| 3819 | + ), | |
| 3814 | 3820 | drag_lock: false, |
| 3815 | 3821 | natural_scroll: false, |
| 3816 | 3822 | click_method: Some( |
resources/default-config.kdlmodified+1 -0
| @@ -25,6 +25,7 @@ input { | ||
| 25 | 25 | tap |
| 26 | 26 | // dwt |
| 27 | 27 | // dwtp |
| 28 | + // drag false | |
| 28 | 29 | // drag-lock |
| 29 | 30 | natural-scroll |
| 30 | 31 | // accel-speed 0.2 |
src/input/mod.rsmodified+7 -0
| @@ -3334,6 +3334,13 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: | ||
| 3334 | 3334 | let _ = device.config_left_handed_set(c.left_handed); |
| 3335 | 3335 | let _ = device.config_middle_emulation_set_enabled(c.middle_emulation); |
| 3336 | 3336 | |
| 3337 | + if let Some(drag) = c.drag { | |
| 3338 | + let _ = device.config_tap_set_drag_enabled(drag); | |
| 3339 | + } else { | |
| 3340 | + let default = device.config_tap_default_drag_enabled(); | |
| 3341 | + let _ = device.config_tap_set_drag_enabled(default); | |
| 3342 | + } | |
| 3343 | + | |
| 3337 | 3344 | if let Some(accel_profile) = c.accel_profile { |
| 3338 | 3345 | let _ = device.config_accel_set_profile(accel_profile.into()); |
| 3339 | 3346 | } else if let Some(default) = device.config_accel_default_profile() { |
wiki/Configuration:-Input.mdmodified+2 -0
| @@ -30,6 +30,7 @@ input { | ||
| 30 | 30 | tap |
| 31 | 31 | // dwt |
| 32 | 32 | // dwtp |
| 33 | + // drag false | |
| 33 | 34 | // drag-lock |
| 34 | 35 | natural-scroll |
| 35 | 36 | // accel-speed 0.2 |
| @@ -186,6 +187,7 @@ Settings specific to `touchpad`s: | ||
| 186 | 187 | - `tap`: tap-to-click. |
| 187 | 188 | - `dwt`: disable-when-typing. |
| 188 | 189 | - `dwtp`: disable-when-trackpointing. |
| 190 | +- `drag`: can be `true` or `false`, controls if tap-and-drag is enabled. | |
| 189 | 191 | - `drag-lock`: <sup>Since: 25.02</sup> if set, lifting the finger off for a short time while dragging will not drop the dragged item. See the [libinput documentation](https://wayland.freedesktop.org/libinput/doc/latest/tapping.html#tap-and-drag). |
| 190 | 192 | - `tap-button-map`: can be `left-right-middle` or `left-middle-right`, controls which button corresponds to a two-finger tap and a three-finger tap. |
| 191 | 193 | - `click-method`: can be `button-areas` or `clickfinger`, changes the [click method](https://wayland.freedesktop.org/libinput/doc/latest/clickpad-softbuttons.html). |