DEV Community

Kir Axanov
Kir Axanov

Posted on

Configs. Touchpad-like scroll with mouse

Hi!

Tired of fixing / blowing / replacing mouse wheel every now and then? Lovin' middle-button scroll in your favourite firefox fork and wanna use it everywhere?

Let's make a touchpad-two-fingers-like-scrolling with a mouse!

(It works like this: you hold some button and drag the mouse up / down / left / right to scroll, the cursor remains in the same place.)

General GNU/Linux

Open / create /etc/X11/xorg.conf.d/99-mouse.conf and add those lines to it (this should work, but untested as I use NixOS):

Section "InputClass"
    Identifier "Mouse Defaults"
    MatchIsPointer "on"
    MatchDevicePath "/dev/input/event*"
    Driver "libinput"
    Option "ScrollMethod" "button"
    Option "ScrollButton" "button3"
EndSection
Enter fullscreen mode Exit fullscreen mode

You can replace button3 (right button here) with the desired button to activate dragging scroll.
To find out the exact button I use xev util.

NixOS

These are the lines to add to your NixOS config:

services.libinput.mouse = {
  scrollMethod = "button";
  scrollButton = 3;
};
Enter fullscreen mode Exit fullscreen mode

Bye!

Top comments (0)