From 5ea9092a4954f8c5cd795f0ebec910666b367d5f Mon Sep 17 00:00:00 2001 From: Bernardo Kuri Date: Mon, 18 Aug 2025 23:51:32 -0600 Subject: Add per-axis scroll speed config for input devices (#2109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add per-axis scroll speed config for input devices. Accepts negative values to inverse scroll direction. Properly complements/overrides global `scroll-direction` setting. Includes docs and tests. * Update per-axis scroll factor implementation after testing - Refined configuration structure in niri-config - Updated input handling to use per-axis scroll factors - Added comprehensive test snapshots - Updated documentation with per-axis examples 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Simplify per-axis scroll factor implementation per review feedback - Make documentation concise and clear - Remove unnecessary comments and test helper functions - Use inline snapshots for tests - Rename get_factors() to h_v_factors() for clarity - Remove unnecessary .clone() calls (ScrollFactor is Copy) - Reduce test count to essential cases only - Fix comment about window factor override behavior 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Remove unnecessary ScrollFactor::new() helper function The maintainer prefers minimal code, so removing this helper and constructing ScrollFactor directly in tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Fix scroll factor behavior - all settings now multiply with window factor Per maintainer feedback, both combined and per-axis scroll settings should multiply with the window-specific scroll factor, not override it. This ensures consistent behavior regardless of configuration method. Also removed the now-unused has_per_axis_override() method. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Final cleanup: remove redundant comments and unused snapshot files - Removed unused snapshot files (now using inline snapshots) - Removed redundant inline comments in tests - Simplified test descriptions to be more concise 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Convert scroll factor parsing tests to use assert_debug_snapshot Updates parse_scroll_factor_combined, parse_scroll_factor_split, and parse_scroll_factor_partial tests to use assert_debug_snapshot instead of manual assert_eq comparisons, as requested in PR review. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Convert to inline snapshots as requested - Convert all scroll factor parsing tests to use inline snapshots instead of external files - Remove external snapshot files to keep test directory clean - All tests still pass with inline snapshot assertions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Fix missed assert_eq in parse_scroll_factor_mixed test Converts the remaining assert_eq calls to assert_debug_snapshot with inline snapshots in the mixed syntax test function. Also fixes raw string delimiters from ### to #. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Convert scroll_factor_h_v_factors test to use assert_debug_snapshot Makes all scroll factor tests consistent by using snapshots instead of assert_eq for better maintainability. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * fixes --------- Co-authored-by: Bernardo Kuri Co-authored-by: Claude Co-authored-by: Ivan Molodetskikh --- docs/wiki/Configuration:-Input.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/wiki') diff --git a/docs/wiki/Configuration:-Input.md b/docs/wiki/Configuration:-Input.md index c9ca0ba2..a03dd67b 100644 --- a/docs/wiki/Configuration:-Input.md +++ b/docs/wiki/Configuration:-Input.md @@ -37,6 +37,7 @@ input { // accel-speed 0.2 // accel-profile "flat" // scroll-factor 1.0 + // scroll-factor vertical=1.0 horizontal=-2.0 // scroll-method "two-finger" // scroll-button 273 // scroll-button-lock @@ -53,6 +54,7 @@ input { // accel-speed 0.2 // accel-profile "flat" // scroll-factor 1.0 + // scroll-factor vertical=1.0 horizontal=-2.0 // scroll-method "no-scroll" // scroll-button 273 // scroll-button-lock @@ -252,6 +254,8 @@ Settings specific to `touchpad` and `mouse`: - `scroll-factor`: Since: 0.1.10 scales the scrolling speed by this value. + Since: next release You can also override horizontal and vertical scroll factor separately like so: `scroll-factor horizontal=2.0 vertical=-1.0` + Settings specific to `tablet`s: - `calibration-matrix`: Since: 25.02 set to six floating point numbers to change the calibration matrix. See the [`LIBINPUT_CALIBRATION_MATRIX` documentation](https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html) for examples. -- cgit