Last active
April 16, 2026 16:39
-
-
Save meyt/82c3cb90c793866881bcc1effcb28de7 to your computer and use it in GitHub Desktop.
Mouse wheel scroll jump fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Mouse wheel scroll jump fix | |
| # | |
| # scenario: scrolling down or up on page using mouse wheel but sometime | |
| # you see small jumps in reverse direction. (you can debug with 'xev' command) | |
| # | |
| # source: https://askubuntu.com/a/1546417/999831 | |
| # | |
| # requirements: | |
| # - sudo apt install xinput | |
| devname="YICHIP Wireless Device Mouse" | |
| # Function to get device IDs | |
| getdevids() { | |
| xinput list | grep -i "$1" | grep -oP 'id=\K\d+' | tr '\n' ' ' | sed 's/ $//' | |
| } | |
| # Function to set property | |
| setprop() { | |
| local devid="$1" | |
| local k="$2" | |
| local v="$3" | |
| echo "Set prop: (ID:$devid) $k=$v" | |
| xinput set-prop "$devid" "$k" $v 2>/dev/null | |
| } | |
| # Get device IDs | |
| mouse_ids=$(getdevids "$devname") | |
| if [ -z "$mouse_ids" ]; then | |
| echo "Error: Device '$devname' not found!" | |
| exit 1 | |
| fi | |
| # Loop through each device ID | |
| for devid in $mouse_ids; do | |
| # Disable natural scrolling (traditional scroll direction) | |
| setprop "$devid" "libinput Natural Scrolling Enabled" 0 | |
| # Enable high-resolution smooth scrolling | |
| setprop "$devid" "libinput High Resolution Wheel Scroll Enabled" 1 | |
| # Disable horizontal scrolling | |
| setprop "$devid" "libinput Horizontal Scroll Enabled" 0 | |
| # Slow down cursor sensitivity (55% speed) | |
| setprop "$devid" "Coordinate Transformation Matrix" \ | |
| "0.550000, 0.000000, 0.000000, 0.000000, 0.550000, 0.000000, 0.000000, 0.000000, 1.000000" | |
| echo "Applied settings to '$devname' (ID: $devid)" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment