Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fastrand = "2.4.1"
futures-util = { version = "0.3.32", default-features = false, features = ["std", "io"] }
git-version = "0.3.9"
glam = "0.32.1"
input = { version = "0.10.0", features = ["libinput_1_21"] }
input = { version = "0.10.0", features = ["libinput_1_27"] }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to bump the requirement? How's distro support?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sticky draglock mode was only added in libinput 1.27, and most current stable distros released already ship libinput 1.27 or newer, maybe we need a runtime checker?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which distros in particular and which not?

Copy link
Copy Markdown
Contributor Author

@zzzsyyy zzzsyyy Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fedora 43/44, Ubuntu 26.04 LTS, Debian 13 Stable/Testing are, while Ubuntu 24.04 LTS, Debian 12 not

ref: repology

keyframe = { version = "1.1.1", default-features = false }
libc = "0.2.185"
libdisplay-info = "0.3.0"
Expand Down
8 changes: 6 additions & 2 deletions docs/wiki/Configuration:-Input.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ input {
// dwt
// dwtp
// drag false
// drag-lock
// drag-lock // timeout mode
// drag-lock "sticky" // sticky mode
natural-scroll
// accel-speed 0.2
// accel-profile "flat"
Expand Down Expand Up @@ -247,7 +248,10 @@ Settings specific to `touchpad`s:
- `dwt`: disable-when-typing.
- `dwtp`: disable-when-trackpointing.
- `drag`: <sup>Since: 25.05</sup> 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).
- `drag-lock`: <sup>Since: 25.02, explicit modes next release</sup> controls drag lock behavior. Can be set as a flag (`drag-lock`), or with an explicit mode (`drag-lock "timeout"` or `drag-lock "sticky"`).
- `"timeout"` (default when set as a flag): lifting the finger off for a short time while dragging will not drop the dragged item.
- `"sticky"`: the drag continues until you tap again to release.
- 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).
- `disabled-on-external-mouse`: do not send events while external pointer device is plugged in.
Expand Down
24 changes: 22 additions & 2 deletions niri-config/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ pub struct Touchpad {
pub dwtp: bool,
#[knuffel(child, unwrap(argument))]
pub drag: Option<bool>,
#[knuffel(child)]
pub drag_lock: bool,
#[knuffel(child, unwrap(argument, str, default))]
pub drag_lock: Option<DragLock>,
#[knuffel(child)]
pub natural_scroll: bool,
#[knuffel(child, unwrap(argument, str))]
Expand Down Expand Up @@ -291,6 +291,26 @@ pub struct Trackball {
pub middle_emulation: bool,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum DragLock {
#[default]
Timeout,
Sticky,
}

impl FromStr for DragLock {
type Err = miette::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"timeout" => Ok(DragLock::Timeout),
"sticky" => Ok(DragLock::Sticky),
_ => Err(miette!(
r#"invalid drag-lock value, expected \"timeout\" or \"sticky\""#
)),
}
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ClickMethod {
Clickfinger,
Expand Down
4 changes: 2 additions & 2 deletions niri-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ mod tests {
window-open { off; }

window-close {
curve "cubic-bezier" 0.05 0.7 0.1 1
curve "cubic-bezier" 0.05 0.7 0.1 1
}

recent-windows-close {
Expand Down Expand Up @@ -993,7 +993,7 @@ mod tests {
drag: Some(
true,
),
drag_lock: false,
drag_lock: None,
natural_scroll: false,
click_method: Some(
Clickfinger,
Expand Down
3 changes: 2 additions & 1 deletion resources/default-config.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ input {
// dwt
// dwtp
// drag false
// drag-lock
// drag-lock // timeout mode
// drag-lock "sticky" // sticky mode
natural-scroll
// accel-speed 0.2
// accel-profile "flat"
Expand Down
8 changes: 4 additions & 4 deletions src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4686,10 +4686,10 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
let _ = device.config_tap_set_enabled(c.tap);
let _ = device.config_dwt_set_enabled(c.dwt);
let _ = device.config_dwtp_set_enabled(c.dwtp);
let _ = device.config_tap_set_drag_lock_enabled(if c.drag_lock {
input::DragLockState::EnabledTimeout
} else {
input::DragLockState::Disabled
let _ = device.config_tap_set_drag_lock_enabled(match c.drag_lock {
Some(niri_config::input::DragLock::Timeout) => input::DragLockState::EnabledTimeout,
Some(niri_config::input::DragLock::Sticky) => input::DragLockState::EnabledSticky,
None => input::DragLockState::Disabled,
});
let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);
let _ = device.config_accel_set_speed(c.accel_speed.0);
Expand Down
Loading