From 4746a0da7dffde6befcb3c80609fa3d31bffc29c Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 26 May 2024 14:41:00 +0900 Subject: Add scroll-method property to pointer devices My use case is to enable middle-button scroll on my keyboard with pointing stick. The device is recognized as USB mouse. --- src/input/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/input') diff --git a/src/input/mod.rs b/src/input/mod.rs index 8bf94d15..a36ea62b 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2232,6 +2232,12 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: let _ = device.config_accel_set_profile(default); } + if let Some(method) = c.scroll_method { + let _ = device.config_scroll_set_method(method.into()); + } else if let Some(default) = device.config_scroll_default_method() { + let _ = device.config_scroll_set_method(default); + } + if let Some(tap_button_map) = c.tap_button_map { let _ = device.config_tap_set_button_map(tap_button_map.into()); } else if let Some(default) = device.config_tap_default_button_map() { @@ -2275,6 +2281,12 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: } else if let Some(default) = device.config_accel_default_profile() { let _ = device.config_accel_set_profile(default); } + + if let Some(method) = c.scroll_method { + let _ = device.config_scroll_set_method(method.into()); + } else if let Some(default) = device.config_scroll_default_method() { + let _ = device.config_scroll_set_method(default); + } } if is_trackpoint { @@ -2287,6 +2299,12 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: } else if let Some(default) = device.config_accel_default_profile() { let _ = device.config_accel_set_profile(default); } + + if let Some(method) = c.scroll_method { + let _ = device.config_scroll_set_method(method.into()); + } else if let Some(default) = device.config_scroll_default_method() { + let _ = device.config_scroll_set_method(default); + } } let is_tablet = device.has_capability(input::DeviceCapability::TabletTool); -- cgit