Middle-click scrolling with ThinkPad/avoid pasting

mousethinkpadx11

I have a ThinkPad USB keyboard, and I want to be able to use the middle click both for pasting and scrolling.

This works on my ThinkPad laptop. On the laptop, if the middle click button is held for a short enough amount of time, then when it is released it is interpreted as "paste." When held for longer, it is interpreted as "scroll."

The problem is that, using the USB keyboard, the decision to paste occurs when the middle button is pressed, not when it is released, so if I try to scroll with middle click, it will paste first, then scroll when I keep holding it down (though interestingly, this paste does not occur if I am already moving the cursor, which is my current workaround).

Is there a way to tell X11 to paste on middle button release rather than press (with the decision to scroll rather than paste being made based on how long it was held for)?

Best Answer

Try enabling scroll emulation with the following commands, which work well on several models of trackpoint keyboard:

dev="TPPS/2 IBM TrackPoint"
xinput --set-int-prop "$dev" "Evdev Wheel Emulation Axes" 8 6 7 4 5
xinput --set-int-prop "$dev" "Evdev Wheel Emulation Button" 8 2
xinput --set-int-prop "$dev" "Evdev Wheel Emulation" 8 1

If you don't like that, you can undo it with

xinput --set-int-prop "$dev" "Evdev Wheel Emulation" 8 0

You may need to adjust dev based on your model of keyboard. Run

xinput --list | grep TrackPoint

to see what your pointing device is called.

Related Question