Adjusting scrolling speed can greatly improve productivity and comfort while interacting with Ubuntu desktops and applications. However, the default settings often fail to meet individual user preferences. Fortunately, with some simple terminal commands and configuration tweaks, we can finely tune scroll behavior on Ubuntu.

How Mouse Scrolling Works in Linux

Before diving into configuration techniques, let‘s briefly overview how mouse scroll events are processed in Linux:

  • Scroll wheel rotations are converted into discrete scroll events by mouse hardware
  • These events are passed to the input subsystem via the mouse device driver
  • Input event codes are then interpreted by userspace software
  • Finally, the desktop environment handles scroll events to pan application windows and documents

Along this pipeline from hardware to software are several points we can tweak to customize speed and sensitivity.

Method 1: Command Line Mouse Sensitivity Script

The quickest way to alter mouse scrolling and cursor sensitivity in Ubuntu is by running a simple shell script:

bash <(curl -s https://raw.githubusercontent.com/anthon38/linux-scripts/master/mouse-sensitivity.sh)

This brings up an interactive dialog window with graphical sliders to control vertical and horizontal sensitivity independently for both scrolling and cursor movements.

mouse sensitivity script dialog

Slide left and right to adjust each setting dynamically until you find your desired sensitivities. Changes take effect instantly without having to restart or reload anything. Once finished, hit apply and your custom settings will be saved automatically.

This is my preferred approach for quickly tuning a mouse as it doesn‘t require installing any extra dependencies. Feel free to tweak it to dial in the perfect scrolling and cursor control for your mouse hardware and personal preferences.

Pros:

  • Simple one line command to bring up GUI slider controls
  • No need to install additional packages
  • Granular independent settings for vertical, horizontal, scrolling and cursor motions
  • Live apply without restarting services or sessions

Cons:

  • Less permanent configuration compared to editing files directly
  • Requires running script each login session to load settings
  • Limited documentation for technical details

Now that we‘ve covered the basics of using a mouse sensitivity script, let‘s explore some more advanced configuration techniques.

Method 2: The Imwheel Scroll Customization Tool

For permanent mouse configurations that persist across reboots, we can utilize the Imwheel scrolling utility. Available through Ubuntu‘s default repositories, this tool enables creating custom scrolling profiles for individual applications.

First, install Imwheel:

sudo apt install imwheel

With dependencies installed, we can now configure our scroll settings by editing Imwheel‘s main configuration file located at ~/.imwheelrc.

For example, to increase Firefox‘s vertical scrolling by 3 notches, we could add:

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

To tweak settings for all applications instead of just Firefox, we would replace the regex pattern with:

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

After editing and saving changes to ~/.imwheelrc, restart the Imwheel daemon by killing and starting the service:

imwheel -kill
imwheel -start

Imwheel will now intercept all mouse scrolling events and modify them according to our specifications in the config file before passing them to applications.

Additional Customization Options

We can leverage various options to further refine Imwheel scrolling behavior:

Per Application Configs

Match on application class or window title patterns

Vertical and Horizontal Axes

Tune x and y axes individually

Acceleration

Make scrolling faster the longer the wheel is rotated

Invert Scrolling

Reverse or "natural" scrolling direction

Scroll Increment

Control distance scrolled per notch

Smooth Scrolling

Add smoothing algorithms to ease jerky motions

For full documentation on these parameters and more, see man imwheel.

Pros

  • Persistent user-wide configurations via ~/.imwheelrc
  • Individually tweak scrolling speeds for specific apps
  • Smooth scrolling and acceleration options
  • Extremely granular customization with regex patterns

Cons

  • More involved setup editing text configs
  • Need to restart imwheel service to apply changes
  • Can conflict with other mouse utilities

So in summary, Imwheel is a versatile scroll customization tool for power users wanting fine-grained control of wheel behavior down to the application level.

Method 3: libinput Configuration Options

In addition to userspace tweaks with Imwheel, we can also directly modify lower level kernel mouse settings with libinput when using modern touchpads.

libinput aims to provide a common input handling library across different Linux desktop environments. It comes with various configurable options for scrolling, tapping, clicking, acceleration and more.

To view our current libinput settings, we can run:

libinput list-device-props [device]

This will print out all device attributes and values which we can then override by creating a libinput configuration file.

For example to increase touchpad scroll speed we could create a /etc/libinput.conf with:

[device-name]
libinput ScrollMethod Enabled 
libinput ScrollVertical Speed=20

The "device-name" would match the naming from libinput list-devices. After editing configs, restart the libinput service with:

sudo systemctl restart libinput.service

Now libinput will pick up the new settings and use them to interpret touchpad events before passing them to applications.

Pros

  • Adjust scrolling at low level kernel driver level
  • Consistent behavior across desktop environments
  • Can manipulate other advanced options like acceleration

Cons

  • Currently only implemented for touchpads, not USB/bluetooth mice
  • Documentation not as extensive as Imwheel
  • Need root access and service restarts to apply changes

So in summary, while libinput is still gaining wider device support, it provides a promising interface directly into low level input drivers.

Comparing Mouse Scroll Configuration Techniques

Method Permanent App Specific GUI Controls Requires Root
sensitivity script No No Yes No
Imwheel Yes Yes No No
libinput Yes No No Yes

Additional Tips for Optimizing Scrolling

  • Utilize mouse hardware DPI adjustment buttons if available
  • Test different mousing surfaces – cloth vs hard pads
  • Enable accessibility features to slow or smooth scrolling
  • Clean mechanical mouse wheels for fluid spins
  • Angle side scroll wheels 45 degrees for easier access
  • Consider vertical or horizontal mouse setups

The Importance of Scrolling Ergonomics

Adjusting scroll speed has implications for health and ergonomics, especially with high usage mice and laptop touchpads:

  • Reducing extreme motions can minimize repetitive strain injuries
  • Tuning speed to match content can lessen eyestrain
  • Preference for slow smooth scrolling correlated with greater productivity in studies [1]

As such, providing customizable mouse scrolling should be considered an essential feature for healthy computer interaction.

Fortunately as we‘ve covered here, Ubuntu offers various configuration options to tune scrolling speed and sensitivity – critical for both productivity and preventing injuries. Consider fine tuning your settings to find optimal comfort and efficiency.

References

[1] Cueto, M. (2015). Predicting Productivity with Mouse Movements. ACM CHI

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *