2

I am trying to figure out to turn off the function behind middle mouse button which inserts whatever text I have copied before into the document I click with that button. As the button of my mouse is quite sensitive I constantly insert text into my documents by accident when scrolling. I tried finding a solution in the unity-tweak-tool (0.0.7ubuntu2), but it appears not to have any setting to that. I found though a function for that in the gnome-tweak-tool (3.18.1-1) under keyboard and mouse > Insert by click with the middle mouse button. It just works sometimes and updates seem to revert this functionality. With sometimes I mean that some program react on turning off the insert functionality by it like gedit and others don't like the Chrome browser.

Is there any way to permanently turn of this text insert functionality of the middle mouse button?

0

This question could be marked as a duplicate of How do I disable middle mouse button click paste? although unfortunately none of the many upvoted answers for that question answer the exact question as asked. Indeed they all give solutions that only work in specific programs or solutions that don't work for any current version of ubuntu. Or they tell you how to disable the middle mouse button altogether even though that is not what you asked. I have answered the following there also but since there it will be buried amongs upvoted answers that don't actually answer the exact question I will consider this question unique since it explicitly asks for a solution that works for all programs which the other question did not.

The solution is given on yet another duplicate but now on another stackexchange site at https://unix.stackexchange.com/a/277488/288916 by Radivarig (All credits go to him). Note that I had to make one change though to make it work:

Install xbindkeys:

sudo apt-get install xbindkeys xsel xdotool

Create a configuration file for xbindkeys ~/.xbindkeysrc with the text:

"echo -n | xsel -n -i; pkill xbindkeys; xdotool click 2; xbindkeys"
b:2

Load the configuration file using

xbindkeys -p

Add this line to ~./bashrc so that xbindkeys always loads on startup.

This is what works for me but what Radivarig suggests is to instead use the line

"echo -n | xsel -n -i; pkill xbindkeys; xdotool click 2; xbindkeys"
    b:2 + Release

This last one does not work for me but if version does not work I suggest to try the other.

After a long time looking this is the only solution I found to work for me that turns off the middle mouse paste button universally without having to disable the middle mouse button completely.

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.