Answer the question
In order to leave comments, you need to log in
How to set element to scroll on middle mouse button press in Linux Xorg?
I would like to make it so that when the middle (or right) mouse button is held down, dragging the mouse up and down scrolls the current interface element up and down, i.e. made scrolling also as if I was dragging the scroll bar on the right. This is how scrolling works on a laptop through the touchpad with two fingers up and down, but there is no touchpad on a full-fledged computer, and I really want to scroll;)
As far as I figured out, you need to dig somewhere in the garden xorg xinput. In theory, such functionality is already in the system, because. when using the touchpad, when you scroll down with two fingers, it works exactly as it should. The question is how to bind the inclusion of this mode to the clamping of the middle mouse button. At the same time, I would like to leave the normal mouse click as a third mouse button click working. Maybe xinput has nothing to do with it and you need to dig into the display manger (I use kdm), but I didn’t find anything similar there either.
Plugins that do this are found for Firefox and Chrome, but I want it to work not only in individual applications, but in all elements of the system at once (I use Ubuntu with the KDE shell, but it also works in GTK applications). Or, if this cannot be done through xorg, then at least some program to run that does this would also be good. For Windows, I have come across such a program (it scrolls the lists by the right button, but that was 5 years ago and I don’t remember the name), but in Linux I can’t find anything how to do it. Please tell me how this can be done or at least in which direction to dig?
Answer the question
In order to leave comments, you need to log in
That's how I do it.
#!/bin/bash
nova_mouse_id=$(xinput list | grep pointer | grep NOVA | grep -o [0-9][0-9])
xinput set-prop $nova_mouse_id 'Evdev Wheel Emulation' 1
xinput set-prop $nova_mouse_id 'Evdev Wheel Emulation Axes' 6 7 4 5
xinput set-prop $nova_mouse_id 'Evdev Wheel Emulation Button' 3
xinput list
xinput set-prop $mouse_id 'Evdev Wheel Emulation' 1
xinput set-prop $mouse_id 'Evdev Wheel Emulation Axes' 6 7 4 5
xinput set-prop $mouse_id 'Evdev Wheel Emulation Button' 3
For fresh Ubuntu 18.04, the old solution stopped working, so I had to invent a new one - in the /etc/X11/Xsession.d folder, create a file like 99mouse-middle-scroll with something like this:
IDS=`xinput list | grep 'slave pointer' | grep -v Virtual | grep -o -P 'id=(\d+)' | grep -o -P '\d+'`
for ID in $IDS
do
xinput set-prop $ID "libinput Scroll Method Enabled" 0, 0, 1
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question