29

Is there a way to change how quickly (or how far) a laptop touchpad scrolls?

This question is specific to 22.04 (Jammy Jellyfish). Although there are many similar questions, none asks specifically about 22.04. The answers for 22.04 will likely differ from past answers because 22.04 (I think) uses Wayland instead of X.org (whatever that means).

Related questions:

Randy Cragun
  • 457
  • 1
  • 4
  • 11

8 Answers8

11

Try the steps below:

  1. Run:

    sudo xinput list
    

    and find the ID for the touchpad ('id of touchpad') of your computer.

  2. Next run:

    xinput list-props 'id of touchpad'
    

    The output will be something like:

    Synaptics Scrolling Distance (351):  -88, 88
    

    As you can see it takes two values. Mine are -88 and 88.

  3. Now try running:

    xinput set-prop 12 "Synaptics Scrolling Distance" -300 300
    

    -300 and 300 worked for me to have a smooth scrolling feeling but try your own values.

11

Background

Ubuntu 22.04 is using wayland display server. Apps either use wayland natively , or via an X / xorg compatibility layer. (Xwayland). See also How can I tell if an application is using XWayland

On my box, most apps are native wayland, but firefox by default is using Xwayland.

Input event handling

I believe input events are handled by libinput. If I run the tool libinput debug-events from libinput-tools package, it shows events for two finger scroll. The docs describe how to configure input devices for wayland apps and xorg apps.

xinput does not anymore seem the right tool to configure input devices. See warning in man page. If at all, it can only configure apps using the Xwayland compatibility layer.

Change two finger scroll speed for native wayland apps

For wayland apps the libinput FAQ is stating:

Use the configuration tool provided by your desktop environment (e.g. gnome-control-center)

Since the ubuntu settings are currently not provide an option to configure two finger scroll speed, I believe it is currently not possible to do this.

Improve scroll speed for firefox

You can make firefox to use native wayland instead of Xwayland and for me it is improving the scroll speed ( slowing it down ). How to do it:

  1. Enter sudo gedit /etc/environment
  2. Add one line at the end of the file, containing this string: MOZ_ENABLE_WAYLAND=1
  3. Reboot system

Source: https://ubuntuhandbook.org/index.php/2022/09/enable-wayland-firefox-chrome/

Hope this helps

Michael S
  • 226
10

The command below will solve the problem of overscrolling:

 xinput set-prop 13 "libinput Scrolling Pixel Distance" 50

where 13 is device id and 50 is the value. The default value was 15. The more the value, the slower the scroll.

Use this command to look at whether the property is getting changed or not, and please play with other values to get a better touchpad feel:

xinput --watch-props 13
vsp
  • 101
5

https://gitlab.com/warningnonpotablewater/libinput-config

this tool worked for me today: "libinput-config allows you to configure your inputs in case your Wayland compositor doesn't have a certain config or has none."

"How it works

The library wraps around libinput and hacks into the event loop to read the config and configure devices. Additional hackery is used to configure scrolling sensitivity and pointer speed. To do all of this, it uses the /etc/ld.so.preload file, which is modified by the install script. If non-GNU libc support is enabled, an LD_PRELOAD fallback is used instead."

Chris
  • 51
4

In my case i had to change my device id according to the value that i found using:

sudo xinput list

Then i could replace the ID in accordance to my specific laptop:

xinput set-prop 17 "libinput Scrolling Pixel Distance" 50

Thanks for your help!

Swift
  • 41
3

For those trying in Ubuntu 24.04.1 LTS (in my case on a Lenovo ThinkPad) I just succeeded in all applications (global OS-wide)

Overall, you're trying to change a parameter called scroll-factor, which is stored deep in the OS somewhere.

Lessons learned the hard way:

  1. xinput doesn't work, because Ubuntu 24.04.1 LTS out of the box uses XWayland.
  2. libinput doesn't work (natively) because it no longer contains the ability to set the scroll factor (because... reasons to do with GNOME Wayland that I don't understand)
  3. THIS https://gitlab.com/cczp/act-2/libinput-touchpad-scroll-fix has been DEPRECATED. This is stated on the page, with a link to libinput-config (see next paragraph).

The correct answer is the libinput-config by NonPotableWater: https://gitlab.com/warningnonpotablewater/libinput-config. This basically writes a wrapper around your native libinput that allows you to set the scroll factor.

Installing libinput-config. How I got it to work.

i. Create a libinput.conf file. Navigate to your root 'etc' folder. touch is just a way of creating an empty file in linux.

cd /etc
sudo touch libinput.conf

ii. Install meson

sudo apt install meson

iii. Configure meson to use the non-glibc compiler (Ubuntu uses gcc by default)

meson configure -Dnon_glibc=true

iv. Download the libinput-config code from gitlab as ZIP and extract. For example, I extracted it to ~/Downloads/libinput-config-default/

v. cd to that folder where you extracted to, e.g.

cd ~/Downloads/libinput-config-default/

vi. Build the libinput-config install files, by running

meson build

This creates the ./build/ folder.

vii. cd into that folder

cd build

viii. Run ninja

ninja

ix. Install libinput-config by running

sudo ninja install

x. Set your desired configuration by editing the libinput.conf file using VIM (or your preferred text editor)

cd /etc
sudo vim libinput.conf

(If you don't know how to use VIM, then GOOGLE IT FIRST. Hint: press i to get into edit mode then ESC, :wq to write and quit the file.)

My libinput.conf file looks like this:

override-compositor=disabled  #doesn't seem to be necessary
scroll-factor=0.3  #seems to be about right, comparable to Windows, might be different on your touch-pad

xi. Log out of Ubuntu and log back in again (and/or restart your machine to be sure).

Following these steps, I managed to set my scroll factor across all applications. scroll-factor=0.3 was about right for me. Any questions or comments, please go ahead!

~Tom

1

For Razer Blade 18, that's the name of the property on PopOS (and probably the same on Ubuntu):

libinput Scrolling Pixel Distance

Decreasing the value, makes it faster. Increasing makes it slower.

xinput set-prop 15 "libinput Scrolling Pixel Distance" 50
Haine
  • 11
0

for me using xinput worked as well. xinput list then xinput list-props <name of touchpad device> and finally xinput set-prop <device name> <property id> <value>

For reference my commands looks like xinput set-prop "ASUE140D:00 04F3:31B9 Touchpad" 346 50

Then add this as a startup command (on Mint there's an app that lets you set up commands on startup but idk how to do it on ubuntu or other distros)

I should add that you should use the full name of the device instead of its id because afaik ids can change when you plug in new devices. The prop id is ok to use (346 for me) because it wont change.