You may have tried to disable the middle click paste (MCP) feature on ubuntu, likely because you work on a notebook/thinkpad or thinkpad keyboard, just to find out that literally every solution to this "issue" does not apply to ubuntu in specific and does just not work. Also since Linux distros have multiple layers of clipboards there are many ways to solve this and to break other functionality at the same time. The obvious solution is to keep the feature enabled but block it on a keymap level for the specific device that should behave "natural". In order to achieve this behaviour we are going to utilize xinput to modify the device mapping. No other device other than the builtin TrackPoint mouse buttons will be affected.
Type in xinput list | grep 'id='
and guess which device is your builtin TrackPoint. Mine is called 'TPPS/2 Elan TrackPoint'
Xinput utilizes a mapping list for all the devices buttons. In order to modify/set this list we first want
to retrieve the current mapping by typing the following command:
´xinput get-button-map ´
which will give an output like:
1 2 3 4 5 6 7
Now that you got the mapping the funny part begins. Each of the entries position corrosponds
to one button and you have to find out which one is the middle button. In order to do this you can simply swap the
existing buttons around and observe the behaviour. Dont worry, this change is NOT permanent across relog/reboots. We will make it permanent once it is working. In order to set a mapping simply use the following command:
xinput set-button-map <id> <mapping>
i.e. xinput set-button-map 17 1 2 3 4 5 6 7
My middle button was the second entry in the mapping part. If you want to disable the MCP feature but still want
to be able to keep the click functionality (Like click/press to scroll in chrome) you simply have to set that button to 0. The following command worked on my T495:
xinput set-button-map 17 1 0 3 4 5 6 7
As mentioned above the changes made to the keymapping will not persist after a reboot until you add it to a startup script. In order to do so you can simply use Ubuntu's 'Startup Applications' application.
Enjoy lazy scrolling without accidential inserts
Doesn't this method literally just block input from middle click entirely? I'm sorry if I'm misunderstanding.