forge
Explore
Log in

Don't you dare go Hollow

Allow disabling tap-and-drag (#1107)

Browse files at this commit

d6e736aaf01b234e62e330e41135f47fe076a6d4UnverifiedAlex David and Ivan MolodetskikhParent: 36b28d9
* Allow disabling tap-and-drag

Similar to https://github.com/YaLTeR/niri/pull/1088, this adds a new
touchpad `drag` configuration option that configures tap-and-drag
behavior.

Currently tap-and-drag is always enabled when the `tap` setting is
enabled, but other compositors allow setting this separately.

* Update wiki/Configuration:-Input.md

---------
niri-config/src/lib.rsmodified+6 -0
@@ -185,6 +185,8 @@ pub struct Touchpad {
185185 pub dwt: bool,
186186 #[knuffel(child)]
187187 pub dwtp: bool,
188+ #[knuffel(child, unwrap(argument))]
189+ pub drag: Option<bool>,
188190 #[knuffel(child)]
189191 pub drag_lock: bool,
190192 #[knuffel(child)]
@@ -3553,6 +3555,7 @@ mod tests {
35533555 tap
35543556 dwt
35553557 dwtp
3558+ drag true
35563559 click-method "clickfinger"
35573560 accel-speed 0.2
35583561 accel-profile "flat"
@@ -3811,6 +3814,9 @@ mod tests {
38113814 tap: true,
38123815 dwt: true,
38133816 dwtp: true,
3817+ drag: Some(
3818+ true,
3819+ ),
38143820 drag_lock: false,
38153821 natural_scroll: false,
38163822 click_method: Some(
resources/default-config.kdlmodified+1 -0
@@ -25,6 +25,7 @@ input {
2525 tap
2626 // dwt
2727 // dwtp
28+ // drag false
2829 // drag-lock
2930 natural-scroll
3031 // 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::
33343334 let _ = device.config_left_handed_set(c.left_handed);
33353335 let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);
33363336
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+
33373344 if let Some(accel_profile) = c.accel_profile {
33383345 let _ = device.config_accel_set_profile(accel_profile.into());
33393346 } else if let Some(default) = device.config_accel_default_profile() {
wiki/Configuration:-Input.mdmodified+2 -0
@@ -30,6 +30,7 @@ input {
3030 tap
3131 // dwt
3232 // dwtp
33+ // drag false
3334 // drag-lock
3435 natural-scroll
3536 // accel-speed 0.2
@@ -186,6 +187,7 @@ Settings specific to `touchpad`s:
186187 - `tap`: tap-to-click.
187188 - `dwt`: disable-when-typing.
188189 - `dwtp`: disable-when-trackpointing.
190+- `drag`: can be `true` or `false`, controls if tap-and-drag is enabled.
189191 - `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).
190192 - `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.
191193 - `click-method`: can be `button-areas` or `clickfinger`, changes the [click method](https://wayland.freedesktop.org/libinput/doc/latest/clickpad-softbuttons.html).