I'm in love with Ubuntu, but I really HATE this feature. I am a programmer and it happened a number of times that I introduced a bug because I inadvertently pasted some code which didn't belong there. I still have nightmares from debugging.

And I can't even turn it off in the 'Mouse and Touchpad' window.

I think it's a weird design decision. Most people expect the middle mouse button to map to scrolling. What was rationale behind this decision?

  • 2
    The middle-button is mapped to pasting when you are in a text field, but mapped to scrolling when not (e.g. on a Firefox page). As Alex L. said, you get used to it quickly. – Paddy Landau Dec 6 '12 at 15:03
  • It doesn't paste when you scroll it. It does when you are in a text input field and click the middle mouse button. I can close tabs using middle-click perfectly well, for instance. – UniversallyUniqueID Apr 18 '16 at 14:39
  • 1
    You're crazy, that is the best Linux feature of all times. – fiatjaf Sep 21 '17 at 17:14

The middle mouse button is mapped to paste the current X-selection, which is normally whatever text is selected. This happens because back in the early days of gui's there was disagreement about how copy/paste should work. Some wanted there to be an explicit command to move something into the copy buffer, others wanted whatever was selected to be moved in there automatically. The makers of X11 (way back when these disagreements were still going strong in the 1980's) decided to implement both and make both sides happy, putting mouse-3 to paste the current selection and ctrl-c/ctrl-v for the copy and paste more commonly found today.

As to how to stop it the unfortunate truth is that you cannot without either patching X or disabling the middle-mouse button all together (which can be done by running

xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9" 

or by putting the line pointer = 1 25 3 4 5 6 7 8 9 in your ~/.xmodmap file).

My advice would be stick it out. The X-selection copy functionality is actually quite useful in many places and it is one of those things you quickly get used it.

|improve this answer|||||
  • 4
    The middle mouse button works very well for copying and pasting in the Terminal, where Ctrl-C and Ctrl-V are replaced with Ctrl-Shift-C and Ctrl-Shift-V. – user68186 Dec 5 '12 at 21:03
  • I don't calling the middle mouse button functionality "copy and paste". It would be much more accurate to call it "select and paste". The clipboard used by Ctrl-C, Ctrl-V is independent from the buffer used for select, middle mouse button. – Flimm Dec 6 '12 at 15:03
  • @Flimm The thing is that there is a copy buffer for the middle-mouse button functionality. It contains whatever was the last text selected at all times. – Alex L. Dec 6 '12 at 15:30
  • 1
    @AlexL: There is a buffer, it's just misleading to call it a "copy buffer". It's a "selection buffer", which is independent from the "copy buffer" used by Ctrl-C. You and I know the distinction, but we should be careful with our terminology so as not to confuse new users. – Flimm Dec 6 '12 at 16:00

It predates Ubuntu and Debian, and the design decision in these OSes has been, as far as I can tell, lack of a contrary design to change historical X-Windows behavior.

I realize I'm responding to an old question, but I'm talking about the 80s and 90s, so I think that's fitting.

See also Jeff Atwood's post at Codinghorror.com. (2008, sheesh! Practically yesterday.)

Especially relevant:

In the UNIX and X Windows world, the middle button has also meant paste since way, way back in the 1980s. I can't find any evidence of this behavior on Windows or the Mac, however. Pasting into text areas wouldn't necessarily conflict with the tab behavior, but it's an odd hodgepodge of behaviors to attach to a single button.

Indeed, I pasted that block quote with my ancient and still functioning PS/2 three-button mouse (no scroll-wheel ; a real three-button mouse).

I recently ordered a new-fangled yet old-school 3-button mouse. This one is optical and has a usb connector. Wow. It was about $20 USD, and available from many online vendors.

Behold, the HP DY651A :

picture of 3-button mouse, circa 2014

I'd say buy one now, so you can enjoy an authentic X-Windows *nix experience before it disappears.

|improve this answer|||||
  • I remember that kind of mouse from back in the day. :-) – Maarten Jun 29 '14 at 22:04

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.