In Ubuntu, the mouse middle-button (wheel-button) pastes the clipboard contents when clicked. When I'm scrolling it keeps pasting things between my codes and most times I don't notice. I can solve this problem temporarily with doing this. But whenever I reboot the my computer, the behavior comes back.

How can I disable this behavior permanently? I don't want my wheel-button to paste.


Create a .desktop file in


The easiest way would be to copy an existing autostart .desktop entry and change the exec line to run the xinput command needed to switch off paste.

Once done, this will execute each time you login.


Assuming you're using ubuntu, they have a guide on how to do it

To sum it up

$ xinput list | grep 'id='

to list all your input devices. Find your mouse there

xinput get-button-map 4

To list all your buttons - you will get a VERY long list of numbers starting with 1 2 3 (which represent left right and middle button)

To disable the middle mouse button

xinput set-button-map 4 1 0 3

to remap it to the left mouse button

xinput set-button-map 4 1 1 3

Scrolling should still work since the scroll wheel is seen as a seperate button

Personally though, swipe + middleclick to copy/paste is awesome

  • As I said in my question, it is not a permanent solution. When I boot my computer, the bad behavior comes back. Oct 21 '11 at 0:34
  • I even mentioned the same link that you have provided! Have you really read my question?! Oct 21 '11 at 0:34
  • 1
    oh, i missed 'To make this set on a per-user basis, I can plug that line into my ~/.xstartup or other init file. It can also be done via configuring a matching InputClass section on xorg.conf. ' , which would make it persistant.
    – Journeyman Geek
    Oct 21 '11 at 0:56

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.