Ubuntu – How does Middle Click paste work

command linexorg

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!

Best Answer

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