From 31dfbcf09b6b86900083e9bba2a0220edbca6a53 Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Sat, 21 Sep 2024 08:22:10 -0400 Subject: [PATCH] Add natural scroll touchpad patch --- README.org | 11 +++++++- config.h | 2 +- dwl.c | 6 +++++ patches.def.h | 2 ++ patches/naturalscrolltrackpad-20240510.patch | 27 ++++++++++++++++++++ 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 patches/naturalscrolltrackpad-20240510.patch diff --git a/README.org b/README.org index 87b5773..efaad09 100644 --- a/README.org +++ b/README.org @@ -9,6 +9,7 @@ - [[#patches][Patches]] - [[#attach-top][Attach Top]] - [[#auto-start][Auto Start]] + - [[#natural-scroll-trackpad][Natural Scroll Trackpad]] - [[#restore-monitor][Restore Monitor]] - [[#vanity-gaps][Vanity Gaps]] - [[#warp-cursor][Warp Cursor]] @@ -72,6 +73,14 @@ Note: Commands from array are executed using execvp(). So if you need to execute #define AUTOSTART_PATCH 1 #+END_SRC +** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/naturalscrolltrackpad][Natural Scroll Trackpad]] + +Set natural scrolling only for trackpads. + +#+BEGIN_SRC c :tangle patches.def.h +#define NATURALSCROLLTRACKPAD_PATCH 1 +#+END_SRC + ** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/restore-monitor][Restore Monitor]] Moves clients to their old output when it is reattached. @@ -231,7 +240,7 @@ static const int repeat_delay = 600; static const int tap_to_click = 1; static const int tap_and_drag = 1; static const int drag_lock = 1; -static const int natural_scrolling = 0; +static const int natural_scrolling = 1; static const int disable_while_typing = 1; static const int left_handed = 0; static const int middle_button_emulation = 0; diff --git a/config.h b/config.h index 0d906f8..72c32b6 100644 --- a/config.h +++ b/config.h @@ -88,7 +88,7 @@ static const int repeat_delay = 600; static const int tap_to_click = 1; static const int tap_and_drag = 1; static const int drag_lock = 1; -static const int natural_scrolling = 0; +static const int natural_scrolling = 1; static const int disable_while_typing = 1; static const int left_handed = 0; static const int middle_button_emulation = 0; diff --git a/dwl.c b/dwl.c index 74d2ef6..bbe9420 100644 --- a/dwl.c +++ b/dwl.c @@ -1187,10 +1187,16 @@ createpointer(struct wlr_pointer *pointer) libinput_device_config_tap_set_drag_enabled(device, tap_and_drag); libinput_device_config_tap_set_drag_lock_enabled(device, drag_lock); libinput_device_config_tap_set_button_map(device, button_map); +#if NATURALSCROLLTRACKPAD_PATCH + if (libinput_device_config_scroll_has_natural_scroll(device)) + libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling); +#endif // NATURALSCROLLTRACKPAD_PATCH } +#if ! NATURALSCROLLTRACKPAD_PATCH if (libinput_device_config_scroll_has_natural_scroll(device)) libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling); +#endif // ! NATURALSCROLLTRACKPAD_PATCH if (libinput_device_config_dwt_is_available(device)) libinput_device_config_dwt_set_enabled(device, disable_while_typing); diff --git a/patches.def.h b/patches.def.h index 04d9ed4..281dee9 100644 --- a/patches.def.h +++ b/patches.def.h @@ -2,6 +2,8 @@ #define AUTOSTART_PATCH 1 +#define NATURALSCROLLTRACKPAD_PATCH 1 + #define RESTORE_MONITOR_PATCH 1 #define VANITYGAPS_PATCH 1 diff --git a/patches/naturalscrolltrackpad-20240510.patch b/patches/naturalscrolltrackpad-20240510.patch new file mode 100644 index 0000000..5cd3742 --- /dev/null +++ b/patches/naturalscrolltrackpad-20240510.patch @@ -0,0 +1,27 @@ +From 8b523453aefdc9d2920c8f9a52de009da251fbb0 Mon Sep 17 00:00:00 2001 +From: neuromagus +Date: Sun, 7 Jan 2024 05:11:24 +0300 +Subject: [PATCH] apply patch naturalscrolltrackpad + +--- + dwl.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/dwl.c b/dwl.c +index 4d19357..26f394b 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -974,11 +974,10 @@ createpointer(struct wlr_pointer *pointer) + libinput_device_config_tap_set_drag_enabled(device, tap_and_drag); + libinput_device_config_tap_set_drag_lock_enabled(device, drag_lock); + libinput_device_config_tap_set_button_map(device, button_map); ++ if (libinput_device_config_scroll_has_natural_scroll(device)) ++ libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling); + } + +- if (libinput_device_config_scroll_has_natural_scroll(device)) +- libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling); +- + if (libinput_device_config_dwt_is_available(device)) + libinput_device_config_dwt_set_enabled(device, disable_while_typing); +