11

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)?

  • 2
    It's surprising to hear that the behaviour of X11 would be different depending on which mouse is being used. I suggest using xev to watch for the ButtonPress and ButtonRelease events to see if your laptop's button is really sending the events you think it is at the time you think it is. It's possible that it's doing some of its own magic instead and "lying" to X11 about when the buttons are pressed and released. By the way, it appears to be normal that paste occurs immediately upon press of button 2, not release. – Celada Mar 24 '15 at 3:42
  • 1
    I would also love to know how to do this as I'm on a Lenovo Bluetooth Trackpoint Keyboard. – Justin N Mar 25 '15 at 20:39
  • That USB keyboard, what exact model is that? Does it have a "real" touchpad or a so-called clickpad (with no physical buttons)? Also, what distro and desktop environment do you use? Is there any special xorg configuration in place ( /etc/X11/xorg.conf and in /etc/X11/xorg.conf.d/ ) ? You may find some pointers here: askubuntu.com/questions/2557/thinkpad-middle-button-scrolling and for clickpad here: askubuntu.com/questions/380825/… – doktor5000 May 10 '15 at 17:13
  • 1
    Any updates on this? I am experiencing the same issue with an external Lenovo keyboard. – languitar Nov 3 '15 at 18:32
  • FWIW, I have two models of bluetooth trackpoint keyboard, and one has this problem. xev shows that the ButtonPress for button 2 as soon as I click, then ButtonRelease when I start to scroll. What should happen is that neither of these events are generated until the action is disambiguated by either moving the trackpoint (in which case neither press or relase are generated) or button 2 is released (in which case, both events are sent upon release). – stewSquared Oct 27 at 3:10
1

This works well for me in /etc/X11/xorg.conf.d/20-thinkpad.conf:

Section "InputClass"
    Identifier  "Trackpoint Wheel Emulation"
    MatchProduct    "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"
    MatchDevicePath "/dev/input/event*"
    Option      "EmulateWheel"      "true"
    Option      "EmulateWheelButton"    "2"
    Option      "Emulate3Buttons"   "false"
    Option      "XAxisMapping"      "6 7"
    Option      "YAxisMapping"      "4 5"
EndSection

The important section is the MatchProduct entry, which includes also the USB keyboard. You can find the keyboard product string in /var/log/Xorg.0.log by grepping for (II) evdev:.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.