In Linux, clicking with the middle mouse button copies the currently selected text or pastes what was copied previously. It's a separate "slot" than the normal copy and paste. What's worse, it overrides the default middle click behavior. For example in some web apps, pasting whatever text I have selected previously, which is very undesirable.

There are sometimes options in individual programs, such as middlemouse.paste in Firefox, but I'd like a solution that works across the entire system without the need to adjust it individually for every program. How can it be achieved?

  • 2
    I'm confused. The "default middle click behavior" is paste :-). it's also kinda hard to do accidentally. Commented May 28 at 8:59
  • 2
    "it overrides the default middle click behavior" - What do you mean by that exactly? What behaviour would you expect from the middle mouse button?
    – marcelm
    Commented May 28 at 9:46
  • I would expect it, for example, to open a link in a new tab, or engage autoscroll in a web browser, or do other things in other programs. It's really unusual for it to end in a paste in any normal program, especially when it hijacks - and replaces - the usual behavior. Commented May 28 at 21:24
  • Middle-clicking in browsers does open a new tab in Linux. At least, it does in Chromium and Firefox. And in the past, in Galeon, Mozilla, Opera, Netscape, and whatever other browsers I've used. Same for programs like Gimp and Kicad which use the middle mouse button for panning. In my 25 years of using desktop Linux, I've never seen middle-click paste "overriding" anything.
    – marcelm
    Commented May 29 at 21:38
  • That said, "It's really unusual for it to end in a paste in any normal program" - No, it's not. Middle-clicking in a place that accepts text pastes the primary selection. That's usual in Linux. Been that way probably for 40 years.
    – marcelm
    Commented May 29 at 21:39

2 Answers 2


without the need to adjust it individually for every program. How can it be achieved?

It kind of cannot, because it is implemented individually within each program. The primary selection buffer is shared, yes, but the actual association of middle-click event with "paste from primary" is not (and neither is standard Ctrl-V clipboard, for that matter). Firefox handles it on its own, GTK-based apps let GTK handle most events, Qt-based apps let Qt handle them, etc.

So, for example, even if you forced the primary selection to remain always empty, it would not change how the apps behave – middle-clicking in Firefox would still lead to it trying to paste from primary instead of doing whatever else you expect it to do. Maybe it will change behavior if the buffer is empty, but more likely it won't.

(And the way primary selection is usually handled, unfortunately, is that toolkits bind its ownership to the literal "selection" (highlighted text) to visualize its contents. So if you had e.g. a clipboard manager that immediately clears the contents of the primary buffer to prevent paste, it would result in text getting immediately deselected in text editors...)

So your best option, most likely, is to find ways to disable middle-click paste at app or toolkit level. GTK3, for example, has an "enable-primary-paste" setting which can be set through its settings.ini or through GSettings:

gsettings set org.gnome.desktop.interface gtk-enable-primary-paste false
gsettings set org.cinnamon.desktop.interface gtk-enable-primary-paste false
gsettings set org.mate.interface gtk-enable-primary-paste true

(In an X11 environment the DE exports this as Gtk/EnablePrimaryPaste through XSETTINGS, so if you're using GTK apps outside of a GNOME-based environment, xsettingsd might be used to publish it – or GTK's settings.ini can be edited directly.)

This option was added for GTK3 and later (GTK2 apps will not recognize it). Nothing for Qt either, unfortunately.


You can use Linux Mint Cinnamon Edition.

In its Mouse and Touchpad applet, look in the General section. Within that section, you will see a toggle for "Paste the current selection when middle-click is pressed". Set that toggle to the off position.

Now middle-clicking will no longer perform the undesired paste operation.

  • 1
    Why the downvote, does this not work? It looks specific to Cinnamon, but sounds plausible? Xfce also has mouse and touchpad options but doesn't have anything paste or middle-click related. Actually, maybe the first line could sound like a command: "USE Linux Mint Cinnamon" and maybe that prompted a downvote from someone with a bad taste for Cinnamon
    – Xen2050
    Commented May 28 at 1:10
  • 3
    @Xen2050 Not the downvoter, but I can certainly see why someone's opinion might be that "you can change your entire operating system to get a GUI to configure this" is not a very good answer to the question, if that's how they interpreted "You can use Linux Mint Cinnamon". No need to assume someone is acting out of bias against Cinnamon or whatever.
    – Ben
    Commented May 28 at 5:30
  • 3
    @Xen2050: My guess is that someone thought "use this specific distro" is a bit overkill as this isn't really a Mint-specific or even Cinnamon-specific setting; all that it ultimately does is flip a toggle that GTK3/4 already has built-in regardless of distro or desktop. (It has no effect on non-GTK3/4 apps.) It just happens that Cinnamon displays it prominently whereas GNOME hides it in the "GNOME Tweaks" app (or in the "Linux Regedit" dconf-editor if you want). Commented May 28 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .