Ubuntu – Permanently fix Chrome scroll speed

google-chrome

So, I am changing the scroll speed in Ubuntu using this answer:

Change mouse wheel scroll speed in Chrome on 12.04 (edit starter bar commandline)

Exec=/opt/google/chrome/google-chrome --scroll-pixels=150 %U

It works, but every time Chrome updates I need to do it again, is there any way I can permanently fix this issue?

Best Answer

Update 2020: just use this script from my repo here and be done: eRCaGuy_dotfiles...touchpad_toggle.sh

Original answer:

Here is a solution which works perfectly (tested recently in Ubuntu 14.04, 18.04, and 20.04):

sudo apt update
sudo apt install imwheel
gedit ~/.imwheelrc

Copy and paste the following into the newly-created .imwheelrc file (that you just made in your home directory via the gedit command above):

".*-chrome*"
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

3 is the "scroll speed multiplier." Use a larger number for faster scrolling, or a smaller number for slower scrolling. The ".*-chrome*" part says to apply these scroll wheel speed increase changes ONLY to chrome.

Run imwheel -b "4 5" to test your settings. When done testing, run killall imwheel to kill it, then make your edits to .imwheelrc, as desired, and run imwheel -b "4 5" again for more testing. Be sure to fully close and re-open Chrome each time you restart imwheel too, to ensure its new settings take effect. This must be done by right-clicking the little Chrome icon in the top-right of your desktop pane and going to "Exit".

Also keep in mind that if you are using a cheap mouse, your scroll wheel decoder may be lousy and miss encoder counts when moving the wheel fast. Therefore, in such a case, move the wheel at a reduced speed when testing the effect of imwheel, so that your mouse doesn't miss encoder counts on the scroll wheel, making you think imwheel isn't working right when it's really just your cheap hardware's problem.

Add imwheel -b "4 5" to Ubuntu's "Startup Applications" to get it to run every time the computer starts.

As Steven C. Howell says here:

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

Another answer by "tvn" here: https://askubuntu.com/a/304653/327339.
More answers here: Increase mouse wheel scroll speed.

Reference notes:

I am not the original author of the answers linked-to above, rather, user "tvn" and others are, although tvn's answer is lacking in that it replaces mouse scroll wheel movements with multiple arrow-key Arrow Up and Arrow Down key presses, which means you have to click in a window for it to take effect, and some things like the browser-based Jupyter Notebook Python programming environment scroll horribly like this! Therefore, Steven C. Howell gave an improved answer which keeps the scroll wheel mapping to the scroll wheel, instead of to keyboard up and down keys, but his answer is lacking in that it applies this new scroll wheel scaling to everything on your computer, so I just modified this answer 27 Aug. 2018 to reflect Steven Howell's answer, but with the addition of adding ".*-chrome*" to the top of the ~/.imwheelrc file so that these new scroll setting apply only to your Chrome browser, which is really what I want. Note also, I have made several significant and important edits and contributions to tvn's answer linked to above, but now I think this answer here is much better, and it's deviated too much from tvn's answer to even attempt to edit his answer further.

Tested in Ubuntu 14.04 LTS.

Update 3 Mar. 2019: tested in Ubuntu 18.04 LTS as well, and it seems the effect takes place immediately in Chrome now each time you run killall imwheel and then imwheel -b "4 5" to test new settings.

Help, my touchpad/trackpad is glitchy when scrolling!

  • This section added 22 June 2019:

Depending on your computer and hardware, the above settings may work best with a mouse with a scroll wheel. On a track pad (again, this may or may not apply to you or your computer) it may make the result very glitchy when trying to do two-finger scrolling on the touch pad. I have a shortcut key (Ctrl + Alt + P) set up to run a script which enables/disables my track pad so I don't bump it while typing and using a mouse, yet so I can still easily enable it for when I don't have a mouse and/or someone else who loves touch pads wants to use my computer. To fix the glitchy scrolling caused by imwheel when using the touchpad, I've just added the following to my script:

When the touchpad is disabled, enable imwheel so my mouse scroll wheel will work well:

imwheel -b "4 5"

When the touchpad is enabled, disable imwheel so my touchpad two-finger scrolling will work well and not be glitchy:

killall imwheel

Doing the above is especially important for my HP Spectre x360 Ultrabook (Model 13-4193nr, and running Ubuntu 18.04), which otherwise has horribly glitchy two-finger touchpad scrolling when imwheel is enabled.

Here is my full touchpad toggle script with those 2 imwheel lines added as described just above:

File "~/bin/toggle_touchpad":
(I keep the latest version updated here: eRCaGuy_dotfiles/.../touchpad_toggle.sh).

#!/bin/bash

# GS_toggle_touchpad.sh
# - toggle the touchpad on and off

# Gabriel Staples
# Written: 2 Apr. 2018 
# Updated: 12 Sept. 2019 

# References:
# - https://askubuntu.com/a/874865/327339
# - https://askubuntu.com/questions/844151/enable-disable-touchpad/1109515#1109515

# Search for id number of "TouchPad" OR "Touchpad" in `xinput` list; manually type `xinput` to see all your devices
read TouchPadDeviceId <<< $( xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p' ) 

state=$( xinput list-props "$TouchPadDeviceId" | grep "Device Enabled" | grep -o "[01]$" )

echo "TouchPadDeviceId = $TouchPadDeviceId"
echo "state = $state"

if [ "$state" -eq '1' ];then
    xinput --disable "$TouchPadDeviceId"
    zenity --info --text "Touchpad DISABLED" --timeout=2
    imwheel -b "4 5"
else
    xinput --enable "$TouchPadDeviceId"
    zenity --info --text "Touchpad ENABLED" --timeout=2
    killall imwheel
fi

Touchpad toggle script source: Enable/disable touchpad

Now just run toggle_touchpad from the command line, or associate it with a keyboard shortcut like Ctrl + Alt + P like I have.

References:

  1. Get the latest version of this script from my repo here! eRCaGuy_dotfiles...touchpad_toggle.sh
  2. Enable/disable touchpad
  3. For new entries to fix scroll speed for Slack and Sublime Text 3 as well, see my latest ~/.imwheelrc file in my project here, and see also my new answer here answer: How do I change the mouse wheel scroll speed in Sublime Text 3?.