348

This question has been asked many times with no answer. I've used my basic Google skills and haven't come across a fix. This is system wide. My mouse simply scrolls too fast.

I'm new to ubuntu and linux in general. Would switching styles or whatever it is called (Ubuntu, KDE, Xubuntu) help at all? Is there a terminal code I can enter?

Jorge Castro
  • 71,754
Unisucs
  • 3,481

14 Answers14

572

I removed the USB dongle that comes with my wireless mouse and plugged it back and fixed my scrolling speed instantly.

jokerdino
  • 41,320
bill
  • 5,853
  • 48
    This answer especially applies to a Logitech mouse connected via their Unifying wireless receiver after switching the "smooth scrolling" option in solaar. – James Caccese May 01 '14 at 04:10
  • 28
    I have a sculpt ergonomic desktop(keyboard & mouse) by microsoft. This solution fixed my problems. – Abhishek Anand Aug 26 '14 at 19:09
  • 50
    This solution works for Microsoft Mouse too. – Quazi Irfan Jun 25 '15 at 20:32
  • 8
    Found the perfect solution. No more unplug and plug. Use resetmsmice, or the deb package directly. – Ted Feng Sep 30 '15 at 02:09
  • 7
    Not sure if it's relevant, but any idea WHY this works (happened to work for me too, thanks!)? – Alan Dec 23 '15 at 01:11
  • 3
    Why does this work? I'd hate to wear out my USB receiver by constantly plugging it in and out :( – Michael Yoo Sep 09 '16 at 20:07
  • Worked for me too...I have the sculpt ergonomic desktop(keyboard & mouse) by Microsoft. – D3GAN Oct 25 '16 at 20:19
  • 2
    -1 This will NOT work if the default settings of the mouse are the problem, like in so many cases and the situation the OP seems to imply. – Nonny Moose Mar 16 '17 at 12:44
  • 1
    @TedFeng You should post an answer suggesting resetmsmice, is a much better solution then plugging and unplugging the USB after every boot. – Arthur Nunes Mar 30 '17 at 00:47
  • 3
    @ArthurNunes I don't have enough score to post an answer. For anyone else who have the problem with microsoft mouse in dual-booting, try resetmsmice, it resets a setting in the mouse through usb communications, which is the root cause of the issue. – Ted Feng Mar 30 '17 at 22:29
  • Worked for me; it sucks that this is the right answer. Is there a bug report? I couldn't find one... I have the Microsoft Sculpt Ergonomic. – quant May 21 '17 at 05:47
  • 1
    It worked perfectly for me. For the record, I have a Microsoft Wireless Mouse 1000. – Luis Milanese Jan 26 '18 at 16:31
  • worked on my ergo microsoft keyboard/mouse as well – MoneyBall Feb 21 '18 at 11:18
  • 2
    Worked for me too. Collected props "pre" (misbehaving wheel) and "post" (wheel behaves). Diff shows propery 'Accel Speed' changed from -0.025743 to 0.00, 'Horizonatal Scroll Enabled' from 1 to 0, and property 'Drag Lock Buttons' were removed. – Tamas Cservenak Apr 19 '18 at 09:16
  • hahahah can't believe it worked for me too!!! X1 thinkpad with microsoft mouse – Bashar Al-Abdulhadi May 16 '18 at 21:13
  • That worked for my Microsoft Wireless Mouse 5000 also, interesting solution by the way, thanks! – Muhammed Kadir Jan 12 '19 at 17:36
  • 1
    This solution worked for me as well. Something appeared to have changed the scroll speed on the mouse (I don't have any DPI settings changed), but unplugging and plugging back in the receiver helped. Logitech MX Master. – Harsha K Mar 28 '19 at 19:02
  • This worked for me with my Microsoft mouse. The issue started for me after I started dual booting into Windows routinely to play a game. – Nick Apr 11 '19 at 17:53
  • This did not suffice for me, the scroll speed persisted (Logitech Performance MX Mouse). However, unplugging, powercycling the mouse and replugging worked and my scroll speed is usable again. – Bluehorn Sep 10 '19 at 13:52
  • 2
    This worked for my Logitech MX Master, I was struggling with this issue for a year or two. Nothing helped. Then after few months I discovered that unplugging and plugging again Unifiying receiver helps to restore scroll speed. This issue is most annoying shit when browsing webpages and one doesn't know what to do. – Marecky May 06 '20 at 20:49
  • This was the 1st google hit for me. I thought to myself “what a stupid answer”, then tried it and it worked… Thanks! – Aleks-Daniel Jakimenko-A. Dec 18 '20 at 13:19
  • does not work . – Bersan Jan 04 '21 at 19:19
  • 2
    OMG this worked facepalm.jpg – Greg Jan 11 '21 at 09:53
  • 1
    Haha! I have lot's of experience with software/hardware and this should have def be my first thing to try. ThnQ – Ricoter Sep 13 '21 at 10:05
  • How can this be an answer if it refers to "usb dongles"? – Antonio Sesto Mar 29 '22 at 07:51
  • I noticed a scroll wheel slowdown after upgrading from ubuntu 18 to 20. Sure enough this worked. – maxTrialfire Jun 10 '22 at 19:10
  • I spent more than an hour yesterday without luck. Today I see this and it instantly works. Logitech mouse :) – codewandler Dec 19 '22 at 05:49
  • it's been almost 10 years now! workaround still works well – Andrew Matiuk May 12 '23 at 22:50
  • Give this guy a fking car! You sir, saved me from a reboot. THANK YOU! – Aries Jul 10 '23 at 18:19
  • This only works for the first few scrolls. Then the issue arise again. – smwikipedia Aug 04 '23 at 14:23
  • I can't believe this works. Instead of unplugging, I can also turn my mouse off and turn it back on to achieve the same affect. – Matt Popovich Sep 14 '23 at 23:11
65

Confirmed working on 20.04:

  1. Install imwheel and adjust (to make things work):
  • Run sudo apt install imwheel
  • Run bash <(curl -s http://www.nicknorton.net/mousewheel.sh)
    • If the above fails, try this alternative address bash <(curl -s https://gist.githubusercontent.com/AshishKapoor/6f054e43578659b4525c47bf279099ba/raw/0b2ad8b67f02ebb01d99294b0ecb6feacc078f67/mousewheel.sh)
  • Using the slider adjust the scroll speed 'multiplier'. (I like it on 4/5)
  1. Add imwheel as a startup application (to make things continue working after restart):
  • Open Apps -> Startup Applications
  • Add a new entry to the bottom of the list: Name= Wheel Scroll Speed, Command= imwheel, Comment= Activates wheel scroll speed fix on system startup (or whatever you like)

Important note:

If you have extra mouse buttons, this might mess things up as far as their functionality. If you find some buttons mis-behaving after following these instructions, you can always go "back" by removing imwheel as a startup application, and restarting your computer.

However, you can still make this work by specifying which buttons to modify in the imwheel command.

imwheel -b "45" this might work for certain mouse types.

imwheel -b "4 5 6 7" this might also work.

In any case, you can try and figure out the button numbers for you own specific mouse scroll wheel, and specify them and only them.

Use the command with button numbers both when running for the first time, and as the command you input as a startup application.


Solution excerpted from here

Important note based on this

  • I don't understand. How to adjust after that? – mathtick Nov 18 '21 at 16:03
  • Once running the bash script, a little pop-up window should open with a slider, allowing to adjust the scroll speed. – Maor Barazani Nov 23 '21 at 13:46
  • 43
    It is simply unbelievable that the speed of the scroll wheel cannot be adjusted without external apps in 2022. – Antonio Sesto Mar 01 '22 at 15:42
  • I guess it broke my horizontal scroll – hijack Apr 14 '22 at 05:28
  • This solution works but broke my forward and back button on my mouse (mousebtn 5 & 6). Please change imwheel to imwheel -b "45" this way it only impacts the scrollwheel. https://askubuntu.com/a/1321943 – Stan Jun 26 '22 at 16:22
  • 2
    The nicknorton.net is down, you can use: bash <(curl -s https://gist.githubusercontent.com/AshishKapoor/6f054e43578659b4525c47bf279099ba/raw/0b2ad8b67f02ebb01d99294b0ecb6feacc078f67/mousewheel.sh) – mefmef Feb 02 '23 at 19:46
  • This works, but breaks Shift + Scroll, sometimes used to scroll horizontally. – vctls Apr 25 '23 at 13:58
  • 1
    @Stan Did you mean imwheel -b "4 5" maybe, for Wheel Up (4) and Wheel Down (5)? – CivMeierFan Oct 31 '23 at 17:42
  • 1
    @CivMeierFan for me 45 without space worked. But when i typed my previous comment this answer didnt have the last part. Which makes my comment irrelevant – Stan Nov 01 '23 at 22:53
38

To change the mouse parameters:

  • list the peripherals, note the good number with the device name of the mouse!

    xinput list
    
  • list parameters from peripheral number 9

    xinput list-props 9
    
  • set the acceleration of peripheral 9 to value 3. The higher the value is, the more you divide the acceleration. Acceleration is maximum for a value equal to 1. The "basis" value seems to be 1.7, for me...

    xinput set-prop 9 'Device Accel Constant Deceleration' 3
    

To permanently set the change :
A hidden file in your directory is ".profile" (Ctrl+H to see hidden files) Double click on it and open it. Copy paste the previous command at the end. That's it!

P.S. to apply the same command for all users you can edit the file /etc/profile (not an hidden file).

Have fun.

soixante4
  • 619
35

First check which device is the mouse:

xinput list

Now pick the ID of your mouse there, and list its current settings:

xinput list-props <device-id>

then change the settings like so where Evdev scrolling distance [vertical] [horizontal] [dial]

xinput set-prop <device-id> 'Evdev Scrolling Distance' 1 3 5

where the combination of the last three numbers is mouse-dependent:

  • first number, the direction of scrolling (minus reverse)
  • second number, speed of scrolling somehow
  • third number, speed of scrolling somehow
  • Changing these values to bigger numbers means you scroll slower (AgentME).
Izzy
  • 3,570
  • assuming this answer is somewhat correct, I would guess the 3 and 5 are acceleration vs. velocity – Alexander Mills Dec 03 '16 at 02:32
  • 9
    this answer would be better if it provided a command to get the settings first, before user decdied to set them – Alexander Mills Dec 03 '16 at 02:33
  • 2
    I don't think this answer is generic - if I do "xinput list-props 10" it says the device is "Sleep button" not the mouse, so check to see what device you're altering... – Alexander Mills Dec 03 '16 at 03:11
  • As far as I'm aware Evdev scrolling distance [vertical] [horizontal] [dial] numbers act as divisors meaning that larger number equal lower distance and negative numbers reverse the direction. – Rtsne42 Mar 16 '17 at 17:54
  • 1
    @LéoLéopoldHertz준영 No need, just wanted to clarify what the values mean. Not enough info for an answer. – Rtsne42 Mar 16 '17 at 17:58
  • 4
    Changing these values to bigger numbers means you scroll slower. If the values are already all set to 1 then there isn't any benefit to touching this setting. – Macil Mar 27 '17 at 02:12
  • Is there a reference to the Evdev scrolling distance parameter? It could well refer to x,y,z (e.g. 3 dimensional, if your mouse has multiple wheels – like Firefox has it with mousewheel.default.delta_multiplier_[x|y|z]. Having such a mouse, I can definitely say modifying the multiplier_x adjusted horizontal scrolling speed. Above mentioned setting reports "1 1 1" in my case – so I have no idea how to increase the speed of horizontal scrolling system wide if that's a devisor – unless it also accepts decimals (e.g. 0.5)? – Izzy Dec 21 '17 at 18:42
  • Changing these numbers has no effect. The default for me is 1 1 1. The only thing I am able to do is when setting the first value to 10, scrolling does not happen. – Aaron Franke Feb 16 '18 at 21:45
  • 40
    I do not have the Evdev scrolling distance parameter – Yifan Sun May 24 '19 at 15:03
  • 1
    Here are what the 3 values mean: https://unix.stackexchange.com/a/442666 – Sam Jul 01 '19 at 09:39
  • Documentation says the following to know the current values : xinput list-props [ ...] – Dino Nov 30 '21 at 20:49
  • Answer should be updated to reflect that Ubuntu now uses Wayland – Randy Cragun Jun 13 '22 at 00:20
27

I have a Logitech PerformanceMouse MX and none of the solutions here worked. The only thing that worked for me was using some parts of this project.

  1. Add this PPA and then install xserver-xorg-input-evdev.
  2. Check out the Solaar project and run rules.d/install.sh. It will copy the udev rules to the appropriate location and ask permissions if necessary.
  3. Remove the receiver and plug it back in.
  4. Add yourself to the plugdev group: $ sudo gpasswd -a <your-username plugdev
  5. Log out and log back in.

Now you can set your scroll-speed with the following xinput commands (source):

$ xinput set-prop <devnum> "Evdev Scrolling Distance" 8 1 1 # for smooth scroll
$ xinput set-prop <devnum> "Evdev Scrolling Distance" -8 1 1 # for smooth 'natural' scroll

Changing the 8 to a lower value increases the sensitivity. Flipping it to negative changes the direction of scroll. Increasing the value decreases sensitivity.

  • 7
    I also have a Logitech Performance MX - on Ubuntu 16.04 just running xinput set-prop 9 'Evdev Scrolling Distance' 3 1 1 solved the problem (9 is my ). No need to install anything. Add this to your .profile file to apply on login. To get the run xinput list. – lenooh Nov 28 '16 at 10:20
  • How to do it without smooth scroll? – Ferrybig Sep 23 '18 at 16:54
  • 1
    Doesn't work in Ubuntu 20.10 as it is using libinput instead of evdev, plus the mentioned PPA seems to be abandoned. – rustyx May 23 '21 at 15:36
  • 1 1 1 is too slow, and I'd like to go faster. Setting any of them to below 1 has no effect (if I ask to read the properties, anything below 1 is simply set to 0!), but setting them higher than 1 definitely slows them down. Any ideas on how to achieve sub-1 values that take effect? – Jason Doucette Feb 07 '22 at 23:57
27

This solution works for me:

sudo apt-get install imwheel zenity

Create a bash script and insert this:

#!/bin/bash
# Version 0.1 Tuesday, 07 May 2013
# Comments and complaints http://www.nicknorton.net
# GUI for mouse wheel speed using imwheel in Gnome
# imwheel needs to be installed for this script to work
# sudo apt-get install imwheel
# Pretty much hard wired to only use a mouse with
# left, right and wheel in the middle.
# If you have a mouse with complications or special needs,
# use the command xev to find what your wheel does.
#
### see if imwheel config exists, if not create it ###
if [ ! -f ~/.imwheelrc ]
then

cat >~/.imwheelrc<<EOF
".*"
None, Up, Button4, 1
None, Down, Button5, 1
Control_L, Up, Control_L|Button4
Control_L, Down, Control_L|Button5
Shift_L, Up, Shift_L|Button4
Shift_L, Down, Shift_L|Button5
EOF

fi
##########################################################

CURRENT_VALUE=$(awk -F 'Button4,' '{print $2}' ~/.imwheelrc)

NEW_VALUE=$(zenity --scale --window-icon=info --ok-label=Apply --title="Wheelies" --text "Mouse wheel speed:" --min-value=1 --max-value=100 --value="$CURRENT_VALUE" --step 1)

if [ "$NEW_VALUE" == "" ];
then exit 0
fi

sed -i "s/\($TARGET_KEY *Button4, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button4, and write new value.
sed -i "s/\($TARGET_KEY *Button5, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button5, and write new value.

cat ~/.imwheelrc
imwheel -kill

# END OF SCRIPT FILE

Now run the script and set your desired mouse wheel speed.

Thanks to: http://www.nicknorton.net/?q=node/10

duli
  • 479
  • 1
    What is Zenity? – neverMind9 May 03 '18 at 13:16
  • 1
    I found my back and forward keys stopped working :O but otherwise nice – Jamie Hutber May 04 '18 at 09:57
  • 1
    @neverMind9 Zenity is a dialog creation utility. It is used by the script I pasted above in order to create the mouse wheel speed selector. – duli May 25 '18 at 02:13
  • 2
    Change the last real line of the script to say imwheel -kill -b "4 5" and your back/forward mouse buttons will work again. – soapergem Dec 14 '18 at 18:15
  • this work awesome !! – Hatim Jun 12 '19 at 12:31
  • I have tried all other solutions, but this is the only thing that has worked! – Daniel Apr 22 '20 at 18:42
  • 1
    But how to make it permanent? – Daniel Apr 22 '20 at 21:52
  • 2
    Daniel - this may or may not work - https://io.bikegremlin.com/11541/linux-mouse-scroll-speed/ – johndpope Apr 23 '20 at 06:07
  • Just implemented this solution (along with the steps given above by @johndpope to make this permanent) on Ubuntu 20.04. Works well with scroll speed set to "3". Suggest changing the range for imwheel to 1 to 10 by setting --max-value=10 in mouse.sh. – AlainD Jun 16 '20 at 14:06
  • This didn't work for me. The scrolling speed increased, but it only started scrolling after a few clicks and than it moved by a lot. There was no way to scroll a little. – Roald Dec 11 '21 at 16:28
21

I have written a simple script which allows you to find which device has this property ( The script basically iterates over all xinput devices and lists only those which have any property containing scroll).

 xinput list | cut -f2 | cut -f2 -d'=' | xargs -d $'\n' -I'{}' sh -c "xinput list-props '{}' | grep -iq scroll && (echo Listing dev id '{}'; xinput list-props '{}')"
 xinput --set-prop 11 295

Note, that for example in Firefox you can set in about:config

mousewheel.system_scroll_override_on_root_content.vertical.factor

Remember to set

mousewheel.system_scroll_override_on_root_content.enabled

to true.

George Udosen
  • 36,677
test30
  • 517
5

Aside from all of these You can use the old good synaptics dirver for this (Yeah I know it is not supported anymore but lets be honest libinput documentation sucks hard).
If you are on 18.04 or above just install synaptics:

sudo apt-get install xserver-xorg-input-synaptics

now go to /usr/share/X11/xorg.conf.d and just edit the file 70-synaptics.conf

cd /usr/share/X11/xorg.conf.d
sudo nano 70-synaptics.conf

find the section Section "InputClass" Identifier "touchpad catchall" then add these options:

Option "VertScrollDelta" "16"
Option "HorizScrollDelta" "16"

The default number is 26 the lower the number it is faster to scroll, the higher it is slower to scroll. Finally it should look like this:

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
#       MatchDevicePath "/dev/input/event*"
        Option "VertScrollDelta" "16"
        Option "HorizScrollDelta" "16"
EndSection

Save the file and close it (Ctrl + O then Enter then Ctrl + X).

Log out and back in for the changes to take effect.

Synaptics driver is a driver with huge options I dont know who in a world has decided to move to the NO OPTION libinput.
Other options can be found at:
https://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html

3

Thanks to this new pull request on https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/-/merge_requests/12 (WIP: Add scroll distance scale setting ), we will be able to change the scroll speed some time in the future (i.e., after that pull request gets merged and the package xserver-xorg-input-libinput is updated with it) without having to use bugged hacks as imwheel.

For now, you can install it directly from the source code:

  1. WARNING: misconfiguration of an X input driver may leave you without usable input devices in your X session. Use with caution.
    • You can help yourself recover from an input problem by allowing an SSH connection to be performed right after your computer boot. So, if you do not have any usable input on your computer, you can always connect to it using the SSH connection to try and fix the input problem/misconfiguration.
  2. First check which version of xserver-xorg-input-libinput is available on your system:
    1. sudo apt-get install xserver-xorg-input-libinput
    2. dpkg -l | grep xserver-xorg-input-libinput
      ii  xserver-xorg-input-libinput                   0.29.0-1                              amd64        X.Org X server -- libinput input driver
      
  3. Then, checkout on the git tag as 0.29.0 correspondent to the installed version 0.29.0 on the package manager.
  4. Edit the source code, applying the following patch:
    --- a/src/xf86libinput.c
    +++ b/src/xf86libinput.c
    @@ -1651,6 +1651,7 @@ calculate_axis_value(struct xf86libinput *driver_data,
            value = libinput_event_pointer_get_axis_value(event, axis);
        }
    
    • value = 3; value_out = value;

      return true;

  5. Change the value of 3 on value *= 3; accordingly to how much you would like to change your scroll speed. To reduce the scroll speed, you can use lower values like 0.9, 0.99, 0.2, etc.
  6. After configuring a desired value, build and install your changes:
    1. sudo apt-get build-dep libinput
    2. autoreconf -vif
    3. ./configure --prefix=/usr
    4. make
    5. make install
  7. In order for changes to take effect, you will have to logout and login of your xorg/user session.
  8. To revert your changes, just reinstall the xserver-xorg-input-libinput using your package manager, i.e., sudo apt-get install xserver-xorg-input-libinput --reinstall
user
  • 475
  • What do I need to do to enable SSH after boot as you recommended? – Cornelius Roemer Jul 28 '21 at 11:01
  • I'm stuck at the ./configure --prefix=/usr/ step as I get an error xorg-server not found https://askubuntu.com/questions/1354566/how-to-install-package-xorg-server – Cornelius Roemer Jul 28 '21 at 11:35
  • If you install ssh server, it should automatically startup on boot (https://www.cyberciti.biz/faq/ubuntu-linux-install-openssh-server/). You can confirm it, installing it and trying to connect to your machine after booting it up. (usually take a minute to ssh service to start up after the boot). Usually, to connect with ssh, you just use your user name (and account password) and machine ip (on your local network) i.e., ssh username@mylocalip – user Jul 28 '21 at 15:33
2

I'm using a "Logitech MAX Master 2". I've tried the solutions in here but what it only works was intalling solaar and modify the configuration through it. Hope this helps.

mmngreco
  • 141
  • 5
1

On my ThinkPad, to change the scroll speed using the TrackPoint, inspired by other answers here, I did

xinput list

and found the TrackPoint to be named TPPS/2 Elan TrackPoint. I use the name and not the ID as I found the ID can change on reboot, making. I continued with

xinput list-props 'TPPS/2 Elan TrackPoint'

under which I saw libinput Scrolling Pixel Distance. I set this using

xinput set-prop 'TPPS/2 Elan TrackPoint' 'libinput Scrolling Pixel Distance' x

where x could be values between 10 and 50 (I experimented), lower values meaning faster scrolling.

I finally added the last command in the end of my ~/.profile.

Rasmus
  • 8,375
  • For Logitech MX Anywhere mouse, I set: xinput set-prop 12 'libinput Scrolling Pixel Distance' 40 - but I don't see any change. This value was set to 15 by default (which is too fast for me). – Danijel Jan 16 '24 at 09:25
  • I use the name and not the ID as I found the ID can change on reboot. – Rasmus Feb 02 '24 at 09:11
1

For Solaar users, the trick was to turn off Scroll Wheel Resolution, i.e. "High-sensitivity mode for vertical scroll with the wheel".

Solaar

0

My problem was slightly different and I'm posting the answer here to assist other users as well. My issue was that the default mouse hardware added by VmWare Fusion or Workstation was not supporting scrolling in Ubuntu and other Linux distros, while the cursor was moving.

The issue seemed at first to be erratic scrolling, slow scrolling (which lead me here), while in fact, it was a different problem. This thread help me fixed it.

https://superuser.com/questions/1270811/inconsistent-and-erratic-mouse-wheel-in-linux-while-moving-the-mouse-pointer#

By moving evdev to a later "init" order, the scrolling came back to act as normal.

xlash
  • 141
  • 4
  • Thanks, but as you are answering a slightly different question, you should have created a new question and answered it yourself. This would be easier to find than through looking at the badly rated answer to a different question. – kbenoit Dec 19 '19 at 20:19
0

Turning the mouse on and off or removing the USB dongle shortly always did the trick for me. However, now it was not working anymore. Neither was the imwheel solution mentioned above a few times. Only after removing solaar the mouse reboot trick worked again.

Roald
  • 291