From 09b34bb40efab4a53c5ce8042cd7f249ac400b22 Mon Sep 17 00:00:00 2001 From: pknepps Date: Thu, 29 Aug 2024 23:33:35 -0400 Subject: [PATCH] Natural scrolling turned off will now turn off natural scrolling for 4-finger gestures --- src/input/mod.rs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/input/mod.rs b/src/input/mod.rs index a98dd647..0a1fe930 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1120,6 +1120,12 @@ impl State { ); // Decide on action if first update if first_update { + let mut natural_scroll = false; + if let Some(scroll_config) = &self.common.config.cosmic_conf.input_touchpad.scroll_config { + if let Some(natural) = scroll_config.natural_scroll { + natural_scroll = natural; + } + } activate_action = match gesture_state.fingers { 3 => None, // TODO: 3 finger gestures 4 => { @@ -1128,18 +1134,36 @@ impl State { { match gesture_state.direction { Some(Direction::Left) => { - Some(SwipeAction::NextWorkspace) + if natural_scroll { + Some(SwipeAction::NextWorkspace) + } else { + Some(SwipeAction::PrevWorkspace) + } } Some(Direction::Right) => { - Some(SwipeAction::PrevWorkspace) + if natural_scroll { + Some(SwipeAction::PrevWorkspace) + } else { + Some(SwipeAction::NextWorkspace) + } } _ => None, // TODO: Other actions } } else { match gesture_state.direction { - Some(Direction::Up) => Some(SwipeAction::NextWorkspace), + Some(Direction::Up) => { + if natural_scroll { + Some(SwipeAction::NextWorkspace) + } else { + Some(SwipeAction::PrevWorkspace) + } + }, Some(Direction::Down) => { - Some(SwipeAction::PrevWorkspace) + if natural_scroll { + Some(SwipeAction::PrevWorkspace) + } else { + Some(SwipeAction::NextWorkspace) + } } _ => None, // TODO: Other actions }