From a480087618ea8835663ae0eb7da3bd066c1941d0 Mon Sep 17 00:00:00 2001 From: chillinbythetree <141879625+chillinbythetree@users.noreply.github.com> Date: Thu, 17 Oct 2024 01:43:47 -0400 Subject: Add scroll-button property for Touchpad, Mouse, Trackpoint, Trackball (#744) --- src/input/mod.rs | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'src/input') diff --git a/src/input/mod.rs b/src/input/mod.rs index ee201922..92475d8e 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2657,8 +2657,20 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: if let Some(method) = c.scroll_method { let _ = device.config_scroll_set_method(method.into()); + + if method == niri_config::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } } else if let Some(default) = device.config_scroll_default_method() { let _ = device.config_scroll_set_method(default); + + if default == input::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } } if let Some(tap_button_map) = c.tap_button_map { @@ -2713,8 +2725,20 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: if let Some(method) = c.scroll_method { let _ = device.config_scroll_set_method(method.into()); + + if method == niri_config::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } } else if let Some(default) = device.config_scroll_default_method() { let _ = device.config_scroll_set_method(default); + + if default == input::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } } } @@ -2735,6 +2759,24 @@ 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()); + + if method == niri_config::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } + } else if let Some(default) = device.config_scroll_default_method() { + let _ = device.config_scroll_set_method(default); + + if default == input::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } + } } if is_trackpoint { @@ -2756,8 +2798,20 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: if let Some(method) = c.scroll_method { let _ = device.config_scroll_set_method(method.into()); + + if method == niri_config::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } } else if let Some(default) = device.config_scroll_default_method() { let _ = device.config_scroll_set_method(default); + + if default == input::ScrollMethod::OnButtonDown { + if let Some(button) = c.scroll_button { + let _ = device.config_scroll_set_button(button); + } + } } } -- cgit