Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't like having the middle mouse button paste, because I often end up with uncompilable code in Eclipse. How can I turn this off (in all programs)? I'm running Fedora.

share|improve this question
Middle-click to insert selection is fundamentally part of the way X11 works; see http://www.jwz.org/doc/x-cut-and-paste.html. – ephemient Nov 10 '11 at 22:44
Just in Eclipse, or in all programs? – Gilles Nov 10 '11 at 23:12
@Gilles: In all programs. :) – derekhh Nov 10 '11 at 23:26
I've not seen any trivial way to do this without nuking the middle mouse button altogether or hacking X or screwing with the normal clipboard as well, so my suggested "solution" is just to learn to use the middle mouse button properly. It's incredibly convenient to be able to highlight a text URL anywhere and go to it by middle clicking in my (FF) browser window. – jw013 Nov 10 '11 at 23:51

Having the middle button paste is a unix user interface standard, like having the left button select or activate, and the right button do something else (such as extending, toggling, firing up a menu, …). You'll find it bound to pasting in most unix applications.

If your problem is that your mouse is overly sensitive when you put your finger on the wheel, I suggest getting a better mouse. There are plenty of cheap decent mice.

You can reassign mouse button 2 to a different number. Applications identify the left, middle and right mouse buttons as buttons 1, 2 and 3 respectively. Put this code in a script that's executed when your X session starts (how to do that depends on your desktop environment).

echo 'pointer = 1 6 3 4 5' | xmodmap -
share|improve this answer
Does not work. pastebin.com/0DYYMDLS – balki Aug 18 '15 at 2:21
@balki Weird. It certainly works for me. So to find out why it doesn't work for you, ask a new question. Be sure to mention which version of X.org (or other X server) you have, which distribution you're running this on, and what input devices are connected. – Gilles Aug 18 '15 at 6:47
@Giles Thanks. will do. – balki Aug 19 '15 at 2:44

It's a common convention that many programs abide by. There is no global way to turn it off, you must do it on a program by program basis.

EDIT: (short of, as Gilles says, disabling mouse button 2. But some programs do have other uses for mouse button 2, so I would not recommend this.)

share|improve this answer
up vote 0 down vote accepted

Finally I'm using the blog post here to solve this problem: blog post

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

This seemed to work for me. I did have to lock my KDE panel but other than that, it seems to have solved my problems. – Jonathan Hult May 4 at 21:23

Maybe you should try this:

For a solution to the problem, please view this guide I wrote: http://www.assembla.com/spaces/slipstream/wiki/Disabling_GTK's_middle_mouse_button_functionality

Or, more directly, here's the patch to disable the 'middle mouse button paste' functionality in GTK: http://subversion.assembla.com/svn/slipstream/patches/gtk_disable_middle_mouse_button_paste.patch

The original answer is over here http://askubuntu.com/questions/4507/how-do-i-disable-middle-mouse-button-click-paste

share|improve this answer

This solution will work globally and preserve the middle mouse functionality.

Install xbindkeys xsel xdotool

Place this in ~/.xbindkeysrc

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

Reload xbindkeys -p

Run xbindkeys on startup, pkill xbindkeys to stop.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.