3

I'm using Ubuntu 12.04 on a lenovo T430s. When using an external keyboard with track-point, I observed the following unexpected behavior: when scrolling (pressing and holding the middle mouse button and moving the track-point), the text I had selected last is being pasted. But this should only happen when clicking (not holding) the middle mouse button. The interesting thing is that this is only happening on the external keyboard, the the keyboard of the laptop is behaving correctly. Furthermore, this is only happening when the track-point is used shortly after pressing the middle mouse button, it is not pasting when I wait for at least a second.

Googling didn't bring up anything. Are there any similar experiences or a workaround I missed?

One acceptable workaround for me would be to disable the middle-button-paste on the external keyboard only, so that I can still use an external mouse to do the pasting. I only found a way to disable this feature completely on all devices, but I use this pasting feature quite and often so I cannot live without it.

3
+50

Use xinput list to find the device you want to disable the button on:

$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=8    [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]

I'll try this on my mouse. Next step is to get the current button map:

$ xinput get-button-map 'Logitech USB-PS/2 Optical Mouse'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 

Turns out my mouse is mapped in a very straightforward way: physical button 1 is logical button 1, etc. This is the default; you may see something different if you've selected left-handed mode for example.

Anyway, the middle button is mouse button 2. To disable it, you set whichever one shows 2 to 0 (disabled) instead. (Hopefully, when you're scrolling, its generating button 4 or 5 clicks, depending on if you're scrolling up or down. That's the normal way for a scroll wheel to work.)

$ xinput set-button-map 'Logitech USB-PS/2 Optical Mouse' 1 0 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Middle-clicking will now be entirely ignored on that one device. To change it back, just run that command again, but with the 2 back in its place. (You can of course also change around your button mappings however you'd like—for example, if you swap 4 & 5, you'll change the direction of the scrolling).

If this does what you want, you only need to arrange to have that last line run as part of your log-in scripts.

|improve this answer|||||

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.