I don't understand the middle click paste.

Sometimes I highlight text, middle click in the window where I want it to go and it does what I want. Sometimes it doesn't.

For instance, when I highlight text in Firefox, then go and middle click into terminal vim, nothing happens.

What is going on?

Thank you!

3 Answers 3


Caused by separate X/DE clipboards; keep them synchronized with ClipIt

  • As ImaginaryRobots' answer explains there are two different clipboards: the X clipboard and the desktop environment/window manager clipboard (Gnome/Unity, KDE, etc.); depending on the selection method used (i.e. just highlighting, or an explicit Ctrl-C/right-click copy, etc.), the two clipboards may not be synchronized.

    • Thus, there are often issues when copying/pasting between GUI programs and the terminal.
  • The easiest solution if you have this problem is to use a tool that keeps both these separate clipboards in sync. I recommend ClipIt (sudo apt-get install clipit)

    • Start clipit (add to Startup Applications for convenience), and under Preferences, check both the Use Primary and Synchronize Clipboards options:

    enter image description here

  • 1
    Wonderful, this is exactly what i needed
    – Fawkes5
    Jul 24, 2012 at 22:26
  • 3
    I prefer to disable clipboard synchronization because sometimes I want to copy something with Ctrl-C, select the text I want to replace and hit Ctrl-V. With clipboard synchronization what I would get is the same text I selected, not the one that I copied.
    – jcollado
    Aug 1, 2012 at 13:23
  • 1
    Give Parcellite a try --a lighter alternative of ClipIt
    – pl1nk
    Aug 9, 2012 at 15:34
  • @ish that's pretty cool. I want to further extend this functionality. Can you please have a look at askubuntu.com/questions/1248629/… and maybe give me some suggestions?
    – supersan
    Jun 10, 2020 at 18:09
  • @pl1nk would appreciate your suggestions as well.. thanks
    – supersan
    Jun 10, 2020 at 18:09

There are actually 2 different kinds of copy & paste - there's the one provided by the underlying X11 graphics system, and there's the one provided by your window manager (Gnome, KDE, etc).

Highlighting text without clicking is enough to get it copied to the X11 buffer-space, and middle-clicking will paste out of that. If you use control-X or control-C, it will use the window-manager's buffer space as well (since you had to have highlighted it to use those keys), but only a control-V will get the text out of there - middle clicking won't.

To make things more confusing, window manager copy & paste will work with non-text items too, so even if your highlighting had gotten some text into both buffers, you might then have some files or complex data in the window-manager buffer instead and the two will be out of sync.

Some applications are smart enough to understand and use both, others aren't. Terminal windows are usually of the stupid variety when it comes to copy & paste. There are usually settings for each application to tell them how to fix the copy & paste mess, but getting them all set up correctly is a lot of work. Ubuntu gets most of them by default, I think.

The situation was historically much worse, and led to freedesktop defining standards around it:



Okay so when you select the text, you must click on an empty area to deselect the text and then middle click wherever you want to paste it, if you don't deselect the highlighted area then it will NOT work.


You must log in to answer this question.

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