Skip to content

Commit

Permalink
Allow disabling tap-and-drag (#1107)
Browse files Browse the repository at this point in the history
* Allow disabling tap-and-drag

Similar to #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

---------

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
  • Loading branch information
alexdavid and YaLTeR authored Mar 2, 2025
1 parent 36b28d9 commit d6e736a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions niri-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ pub struct Touchpad {
pub dwt: bool,
#[knuffel(child)]
pub dwtp: bool,
#[knuffel(child, unwrap(argument))]
pub drag: Option<bool>,
#[knuffel(child)]
pub drag_lock: bool,
#[knuffel(child)]
Expand Down Expand Up @@ -3553,6 +3555,7 @@ mod tests {
tap
dwt
dwtp
drag true
click-method "clickfinger"
accel-speed 0.2
accel-profile "flat"
Expand Down Expand Up @@ -3811,6 +3814,9 @@ mod tests {
tap: true,
dwt: true,
dwtp: true,
drag: Some(
true,
),
drag_lock: false,
natural_scroll: false,
click_method: Some(
Expand Down
1 change: 1 addition & 0 deletions resources/default-config.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ input {
tap
// dwt
// dwtp
// drag false
// drag-lock
natural-scroll
// accel-speed 0.2
Expand Down
7 changes: 7 additions & 0 deletions src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,13 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
let _ = device.config_left_handed_set(c.left_handed);
let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);

if let Some(drag) = c.drag {
let _ = device.config_tap_set_drag_enabled(drag);
} else {
let default = device.config_tap_default_drag_enabled();
let _ = device.config_tap_set_drag_enabled(default);
}

if let Some(accel_profile) = c.accel_profile {
let _ = device.config_accel_set_profile(accel_profile.into());
} else if let Some(default) = device.config_accel_default_profile() {
Expand Down
2 changes: 2 additions & 0 deletions wiki/Configuration:-Input.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ input {
tap
// dwt
// dwtp
// drag false
// drag-lock
natural-scroll
// accel-speed 0.2
Expand Down Expand Up @@ -186,6 +187,7 @@ Settings specific to `touchpad`s:
- `tap`: tap-to-click.
- `dwt`: disable-when-typing.
- `dwtp`: disable-when-trackpointing.
- `drag`: can be `true` or `false`, controls if tap-and-drag is enabled.
- `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).
- `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.
- `click-method`: can be `button-areas` or `clickfinger`, changes the [click method](https://wayland.freedesktop.org/libinput/doc/latest/clickpad-softbuttons.html).
Expand Down

0 comments on commit d6e736a

Please sign in to comment.