116

As the title says, I want to increase the number of rows that are passed when I use the mouse wheel for scrolling. I know that there exists ways to do that for Firefox and Chromium, although I want something for the entire system, mainly because of the PDF reader.

I am on a Desktop and use a Microsoft Wireless Mouse 5000.

Mikel
  • 6,558

9 Answers9

113

Beforehand

With the currently used input driver system it is not possible to change the scroll speed of your mouse, at least not without drawbacks. You are able to adjust the scroll speed for Qt-Applications using a KDE Settings but the only current way to change the scrolling in a generic fashion is by using imwheel which seems to be problematic in many ways (see comments). In the future this will be fixed with libinput and the systemd hardware database.

Current Way

Install imwheel with the following command or from the Software Center:

$ sudo apt-get install imwheel

Create (if necessary) and edit the configfile ~/.imwheelrc with an editor of your choice (e.g. gedit). Fill in the following for increasing the scroll speed for every Command. NB: This configuration file will apply these new scroll settings to all programs, (including the terminal, which may not be what you want).

".*"
None,       Up,     Up,     3
None,       Down,   Down,   3

If you want to only apply these settings to Chrome, for instance, use these settings instead:

".*-chrome*"
None,       Up,     Up,     3
None,       Down,   Down,   3

The 3 is a scroll multiplier to increase the effectiveness of the scroll wheel. In the README of the project it is called "REPS". The readme states:

[ REPS ]

Reps (Repetitions) lets you say a number for how many times you want the output keysyms to be pressed. See the chart on the default bindings for the default number of reps for each modifier-combo (The chart is near the end of this document).

In other words, it is a scroll multiplier. If REPS is set to 3, that means that when your mouse wheel commands one scroll command, the software intercepts this command and sends 3 commands to the PC instead of 1, thereby making it scroll 3 times farther, or "faster".

For more information also take a look at the manpage:

$ man imwheel

or refer to the README of the project.

You can start imwheel by typing:

$ imwheel

Be sure that you don't start the imwheel twice! That's a known bug, but you can stop imwheel with the command:

$ killall imwheel

To get imwheel to automatically start every time your computer boots, you must add it to the startup menu AFTER an x-window is loaded. IMPORTANT: since imwheel relies on an x-window to already be running, it will NOT work if you add it to crontab, /etc/init.d, or /etc/rc.local. That means you must do it this way instead:

Ubuntu:
Use the "Startup Applications" GUI editor to Add imwheel as a Startup Program: https://askubuntu.com/a/48327/327339

Xubuntu:
Use the "Session and Startup" GUI editor --> Application Autostart --> Add to add imwheel as a startup program.

enter image description here

More screenshots here: https://askubuntu.com/a/369443/327339.

Future

This tutorial is currently under development.

libinput seems to be included with Wily Werewolf (15.10) where you need to install the package xserver-xorg-input-libinput. After you installed libinput with

$ sudo apt-get install xserver-xorg-input-libinput

it should be used for every input after you restarted the Xorg (logout would be sufficient). Now that you are using libinput you are able to adjust the settings of your mouse. You can find a full tutorial in the file /lib/udev/hwdb.d/70-mouse.hwdb. Let me cover here only the basics.

The following steps are need to be done as root. Because of that I am friendliy reminding you that everything you do you need to take responibility.

First get the vendor id <vid> and the product id <pid> using lsusb. Here with a MX 518 Logitech Mouse as example. If you have the following line in the output of lsusb.

Bus 005 Device 002: ID 046d:c051 Logitech, Inc. G3 (MX518) Optical Mouse

The <vid> is 046d and the <pid> is c051.

Then create a File that looks like the following with gksudo gedit /etc/udev/hwdb.d/71-mouse-local.hwdb

mouse:usb:v<vid>p<pid>:name:*:
    MOUSE_WHEEL_CLICK_ANGLE=??

For example this file for the Logitech MX 518 example above:

mouse:usb:v046dpc051:name:*:
    MOUSE_WHEEL_CLICK_ANGLE=30

This file sets the mouse wheel click angle to 30° (default is usually 15). To use this setting, update the hwdb with the following commands:

udevadm hwdb --update
udevadm trigger /dev/input/event${id}

One can figure out the ${id} using xinput (look out for the id of your mouse) and then run xinput list-props ${xinput_id}.

tvn
  • 1,718
  • 3
    It worked! Thanks, although the only thing I have to complain is that using imwheel disables the function to change between windows just scrolling the mouse over their icons in the Unity Launcher. – Rodrigo Oliveira Jun 06 '13 at 13:04
  • 2
    You're welcome. Yesterday I checked your problem, if you only need the increased wheelspeed on your pdf viewer you can replace the ".*" by "Evince" if you're using Evince. Then the Unity-Launcher works as expected. – tvn Jun 07 '13 at 08:30
  • 2
    Can the numbers go lower? My wheel scrolls way too fast. Trying '1' in place of '3' is still too fast. – DarenW Sep 05 '13 at 00:47
  • 1
    @DarenW have you tried numbers like '0.5' ou '0.1' ? – Rodrigo Oliveira Sep 26 '13 at 16:53
  • 6
    This is a bad, hacky not really working method. In Nautilus the marked files jump 3 lines back or forth instead of actually scrolling. It scrolls when you getting "over the borders" but its like bushing up/down on the keyboard 3 times. Same in sublime text and I guess in a lot of other progs. (Ubuntu 13.10) – redanimalwar Feb 04 '14 at 05:45
  • 1
    Got it properly working see my answer. – redanimalwar Feb 04 '14 at 06:11
  • 1
    Scrolling on chroumium tab bar doesn't switch tabs when imwheel is run. – Amir Karimi May 02 '14 at 18:29
  • 1
    Is there an update for 16.04 LTS? For me, only the first (current)way worked. – loki May 08 '16 at 16:16
  • However, the "scroll-where-mouse-over" effect is missing with this way. Can anyone help on this issue? – loki May 08 '16 at 16:22
  • I played around with all kinds of configs with the libinput method but couldn't get the changes to take. I'm on elementary 0.4 but I imagine the 16.04 statement means that libinput isn't implemented as we may think – Wolf Oct 17 '16 at 20:29
  • people who want to automate this: Don't think about “upstart” (way to early), simply add to startup applications – Frank N Nov 17 '16 at 09:49
  • `imwheel --kill' is now an option against unwanted prior instances. – Frank N Nov 17 '16 at 12:02
  • Is there a away to get rid of the nasty side-effect in Terminal windows? –mousewheel now iterates prior commands rather then scrolling window content) – Frank N Nov 17 '16 at 12:04
  • 1
    Is there a away to get rid of the nasty side-effect in Terminal windows? –mousewheel now iterates prior commands rather then scrolling window content) — Answer 8-): There is, i.e. by limiting the mather in line one to Windows named ".*-chrome" – Frank N Nov 17 '16 at 12:16
  • 6
    Has anyone had success with the Future solution yet? I've attempted it but I haven't gotten it to work. I wish I knew of a way to even know if MOUSE_WHEEL_CLICK_ANGLE is even successfully changed, but I don't know how to check its current value. The default angle varies with the mouse btw., as visible in /usr/lib/udev/hwdb.d/70-mouse.hwdb, though most have 15 at the moment. – miyalys Apr 08 '17 at 15:01
  • ".*-chrome*" probably meant to be ".*-chrome.*"? – Frank N Sep 12 '17 at 07:00
  • 1
    nice and NOT EASY AT ALL – wayofthefuture Nov 04 '17 at 16:20
  • 4
    @miyalys libinput debug-events should show scrolling and other pointer events so that you can at least see the numbers have changed according to your custom configuration. – Jani Uusitalo Mar 21 '18 at 15:41
  • libinput (FUTURE) method didn't work for me – zwolin Sep 24 '18 at 15:47
  • example file now at /lib/udev/hwdb.d/70-mouse.hwdb – sjas Oct 11 '18 at 21:34
  • 1
    For me the future solution didn't work either, so I made the following bug report https://github.com/systemd/systemd/issues/10459. If it doesn't work for you either, please leave a comment over there. – InvisibleShadowGhost Oct 18 '18 at 20:54
  • The click angle property does not seem to be meant for setting the scroll speed. Although it works that way, it seems to be rather thought to be a hardware specific setting to scale the click events with the hardware, so every mouse scrolls the same amount.

    The problem is that libinput currently does not seem to support the changing of scroll speed. Thus I created an issue for scroll speed there, which you can support by voting it up: https://gitlab.freedesktop.org/libinput/libinput/issues/185

    – clel Nov 25 '18 at 17:04
  • Steven C. Howell's answer (https://askubuntu.com/a/621140/327339) works much better than this one, and here's my twist on it: https://askubuntu.com/a/991680/327339. – Gabriel Staples Jan 14 '19 at 04:34
  • Installing and starting imwheel works for me Lubuntu 19 - it fixed the failing mouse wheel. – Felipe Apr 20 '19 at 12:56
  • 2
    Nah that's enough ubuntu for me I think. Great server software, but useless as a desktop. Something as simple as changing the scrollwheel speed requires a heavy amount of base knowledge in cli and linux kernel. I'll keep using you for my webservers but it's back to windows for me I'm afraid – Abraham Brookes Nov 17 '19 at 06:03
  • I'm using Ubuntu only for about 10 days and you just improved my experience drastically! Thank you! – Michael Malinovskij May 29 '20 at 18:18
  • imwheel seems to work well for Chrome in both x11 and Wayland window managers in Ubuntu 22.04, but it works for other programs, such as Sublime Text, only in x11! It won't work in Wayland. Any idea why, or how to fix it? – Gabriel Staples Jun 01 '23 at 22:45
  • imwheel has multiple side effects for me. Quite often it scrolls in completely unexpected locations/windows. Absolutely unusable, sadly :-( – Alex Dec 07 '23 at 09:51
45

Note that using the ~/.imwheelrc recommended in the accepted answer does not actually increase the scroll wheel speed. Rather, it replaces scrolling with multiple arrow key strokes. This has the disadvantage of not being able to scroll a window until you change focus to it, not the default behavior. This answer aims to provide an alternative that behaves more closely to the native behavior.

To provide a concise answer for Ubuntu >14.04 (combining the answers from @tvm and @redanimalwar with the comment from @aroll605), it seems the best option to actually increase the scroll wheel speed is to install imwheel and configure it by following these steps:

  1. Install imwheel by running:

    sudo apt install imwheel
    

    (replace apt with apt-get depending on your system)

  2. Edit ~/.imwheelrc:

    gedit ~/.imwheelrc
    

    and paste:

     ".*"
     None,      Up,   Button4, 3
     None,      Down, Button5, 3
     Control_L, Up,   Control_L|Button4
     Control_L, Down, Control_L|Button5
     Shift_L,   Up,   Shift_L|Button4
     Shift_L,   Down, Shift_L|Button5
    

    You should try different values for # in the lines:

     None,      Up,   Button4, #
     None,      Down, Button5, #
    
  3. To test the settings use the command:

    killall imwheel && imwheel -b "4 5"
    
  4. Open Startup Applications and add:

    imwheel -b "4 5"
    

    Note that using the option -b "4 5" restricts imwheel to only affect the scroll wheel, discussed here.

  • 2
    My scroll is really jerky/delayed with this – Wolf Oct 17 '16 at 07:38
  • 1
    @Wolf, did you try smaller values in place of #? 2, 1, or even a decimal value, e.g., 0.5? – Steven C. Howell Oct 17 '16 at 13:27
  • Yep. It appears to stutter even at low numbers, like one click of the wheel sometimes scrolls a little and then jumps the rest of the distance. I remove the program and go back to buttery smooth, just not the scroll interval I'd prefer. I think it would be useful to add a little bit about what the numbers mean, though—the solution worked best for me at 2, all stuttering considered. – Wolf Oct 17 '16 at 20:27
  • I would recommend trying another mouse to compare the behavior, not as a solution but to narrow down the source of the problem. If another mouse still skips, there is a definite problem in your configuration; you could make this a more sure conclusion by testing with a live CD, to see if something changed since installation. If the other mouse does not skip, then you mouse of choice is unfortunately not well supported on Ubuntu; maybe you can search for other people with the same mouse and what they did. – Steven C. Howell Oct 18 '16 at 01:53
  • ^ this worked for me – Jamie Hutber Nov 11 '16 at 12:37
  • 2
    This answer is the best on this page I think! But....I've now improved upon your answer and made an even better answer I think: https://askubuntu.com/a/991680/327339. I've added ".*-chrome*" instead of ".*" to the top of the ~/.imwheelrc file so that these new settings apply only to my Chrome browser and nothing else. – Gabriel Staples Aug 27 '18 at 23:06
  • Quite frankly, this should be the accepted answer as the current one is like OP said, just a bunch of up/down arrow instead of mouse scrolls. Really annoying in documents and terminal... Thanks! – JulioQc Jan 06 '22 at 12:57
34

// Edit

As this gets some upvotes from time to time: I not use this anymore (out of laziness after reinstalls) and I now think this script the slider and stuff is too much overhead. Also people have pointed out issues with this over time. So as a minimalistic guy I now created the config myself. Its probably a one time thing for most people.

I have edited this to be a 4 step guide with everything you need.

And another update: Since I switched to KDE, that actually has a setting for this and a million others things Gnome does not (Not even realized how much i missed KDE). The issue is that KDE mouse settings have actually have no effect on Firefox (and other GTK apps I assume) but since my main purpose for this was actually web browsing I now found out that you can actually tweak how much the mouse scrolls in Firefox itself.

about:config
mousewheel.default.delta_multiplier_y

I set it to 600 and its perfect for me

// End Edit

The accepted answer has a config that for whatever reason maps the scrolling to UP and DOWN on the keyboard. Makes no sense to me.

I have found a perfect script that actually maps to the mouse and adds a GUI to set up the mouse speed.

#!/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

There is also a video where it is introduced. I have not even finished watching this because I got it running in no time. The following would install the required packages, download the script and execute it for us:

sudo apt-get install -y imwheel
wget http://www.nicknorton.net/mousewheel.sh ~/bin/set-mousewheel
chmod +x ~/bin/set-mousewheel
~/bin/set-mousewheel

Set the wheel speed on a nice slider and be happy. Later just change with set-mousewheel command.

Not sure if imweel is automatically started after install, else we need to add it to startup applications.

redanimalwar
  • 1,550
  • 3
  • 19
  • 35
  • 2
    Outstanding stuff! The script doesn't work out of the box in Ubuntu 14.04 LTS, but if I take the config directly out of the script and put it into .imwheelrc, it works like a charm. – aroll605 May 26 '14 at 00:29
  • There seems to be a bug with it in 14.04 LTS. Occasionally, it would stop the wheel from working completely, until I restart the process. Happens only on boot and 'imwheel' is included in the startup applications list. – aroll605 Jun 23 '14 at 17:21
  • 2
    I've had the problem that imwheel kills the back/forward buttons. The fix is to start imwheel with the options imwheel -b "4 5" to restrict it to the scrollwheel: http://askubuntu.com/questions/421645/imwheel-destroys-back-forth-navigation-buttons-from-my-mouse – jmiserez May 12 '16 at 09:08
  • 1
    Thats great, but you can't use back/forward buttons – Jamie Hutber Oct 19 '17 at 17:54
  • good work on the mapping, but the script didn't run on my ubuntu: command 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 returned error: This option is not available. Please see --help for all possible usages. – Mobigital May 24 '18 at 20:39
16

My two cents: my Microsoft Sculpt Ergonomic mouse was scrolling about half a page at a time on Ubuntu 15.04 (Lenovo ThinkPad x220), which was really annoying me. I tried various solutions, but ended up having the idea of disconnecting the mouse from the USB port (the wireless dongle thing) and reconnecting it. Voila!..."normal" scrolling speeds ensued :). Hope that helps somebody.

sammy34
  • 261
  • 2
  • 3
10

While the above imwheel suggestions helped a bit, I found that removing the mechanical scroll-clicking mechanism made my mouse wheel much more pleasant to use -- not only removing the click, but making it faster and more precise to control!

And it only took 3 minutes - check out these instructions:

http://www.instructables.com/id/Making-a-mouse-wheel-not-click./

In a nutshell, you're removing this left spring (be careful to get the right spring back in place exactly):

enter image description here

Note: I have a standard, cheap mouse - a Logitech B100, others report success on similar models. Your mileage may vary.

Jeff Ward
  • 945
  • 3
  • 10
  • 17
  • Much easier to use xmodmap to disable the mouse middle button. (xmodmap .Xmodmap) where your .Xmodmap file contains the line "pointer = 1 0 3 4 5 6 7 8 9 10 11 12 13 14 15 16". The zero turns off the middle button. Run xmodmap [path-to-your-.Xmodmap] at startup. – Harryg123 Mar 20 '19 at 13:38
  • I recommend this. I have a Logitech B100 too, and after doing this, I no longer feel the scrolling friction. Now I can pleasantly scroll long pages without the noise driving me crazy. – Manish Chandra Joshi Dec 24 '20 at 10:49
5

imwheel will emit double scroll events in chrome, which is annoying

For i3wm and libinput users, I suggest libinput_patch, which gives an entry to change scroll delta in real time, and is much better in my use case

bilabila
  • 151
5

I also wanted to increase the mouse scroll wheel acceleration, and not just the absolute speed. This is a feature in MacOSX but not builtin for Xorg (also Wayland) yet.

I implemented such a feature in user space here (mouse-scroll-wheel-acceleration-userspace). This will increase the scroll speed, or accelerate the scroll speed. You would just run this in the background, with your preferred options. The code is quite simple Python code, and should be easy to modify as well.

Installation:

# get the tool
git clone https://github.com/albertz/mouse-scroll-wheel-acceleration-userspace.git
cd mouse-scroll-wheel-acceleration-userspace

install Python dependencies

sudo apt install python3-pip pip3 install --user -r requirements.txt # (basically pynput)

run the tool

./main.py -v --exp 1 # example flags. see --help

(leave this running in background)

Albert
  • 2,577
  • 1
    perhaps you could add the installation instructions here? – Zanna Jan 18 '21 at 17:16
  • 1
    @Zanna: Sure. It's really simple. I added it. – Albert Jan 18 '21 at 18:08
  • 2
    +1

    While this is not an exact solution for "increasing wheel speed", this is actually much, much, much better (IMHO). Adding support for acceleration adds the benefit of still being able to scroll slowly whenever you want. So many kudos to you for providing us with such an elegant solution.

    – Tafel Jul 30 '21 at 12:05
  • Upvoted, but I think it needs some work. Tested on Ubuntu 22.04 running the default Wayland window manager. The tool does work, but it's flaky, frequently missing encoder counts on the mouse wheel when scrolling really slowly. Turning off the tool allows my computer to respond to each wheel tick again. – Gabriel Staples Jun 02 '23 at 04:33
  • Also, just like imwheel having problems working in programs other than Chrome, such as in Sublime Text (I'll describe this in my answer here shortly), this tool also doesn't work in programs other than Chrome, such as in Sublime Text. – Gabriel Staples Jun 02 '23 at 04:37
2

I just searched for this problem, because after a reboot my mouse wheel got really slow. After trying to solve it with different applications (imwheel, ...) I just unplugged it and plugged it in again and it worked like before. So if the speed changed between restarts without you doing anything, this might be worth trying.

1

I modified mousewheel.sh in order to include horizontal scroll speed adjustment:

#!/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, 1
Shift_L,   Down, Shift_L|Button5, 1
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
killall imwheel ; 
imwheel
imwheel -kill -b "4 5"

Added 3rd and 2nd last lines in order to kill and restart imwheel process on manjaro/arch, remove them if they cause bugs on ubuntu.