73

I'm constantly frustrated by the two separate clipboards in X/Gnome. I'm constantly doing things like control-C to copy, and then middle-click to paste, and getting the wrong data. Or select something, then go where I want to paste it, and selecting what I want to paste over, only to lose my first selection!

Is there any way to merge these two clipboards?

Update: Parcellite comes close, but pasting over a selection is really essential. Is there a way to disable select-as-copy in X?

TREE
  • 1,297

9 Answers9

36

autocutsel is what you want to sync between the primary X/X11 clipboard and the Gnome/GTK clipboard! Here's how:

$ autocutsel &
$ autocutsel -s PRIMARY & 

Magic!

a paid nerd
  • 3,481
35

"autocutsel" will not do what you want.

This issue has existed for over a decade, till I found a fix a few weeks back.

You need to do this:

apt-get install parcellite

Right click go on the icon and go to the "Preference"

Check the following:

  • Use Copy (Ctrl-C)
  • Use Primary (Selection)
  • Sync clipboards
Spooky
  • 438
7

So I actually like to keep the various copy buffers separate, and occasionally sync from one or the other (like when I'm using keepass2.) So if I want to move something from the clipboard to the primary copy (middle mouse button) buffer, I'll do:

xclip -o -selection clipboard | xclip -i 
Pylsa
  • 31,383
Dale
  • 71
  • 1
  • 2
2

It's not gnome, but Klipper from KDE has an option to do this. I'm getting frustrated by the lack of it in gnome as well.

Daenyth
  • 6,460
2

I think autocutsel will solve your problem. Most distro package cleverly as "autocutsel". In ubuntu it's in the universe repository.

DaveParillo
  • 14,761
1

CopyQ seems to do this as well.

To enable it, open CopyQ Preferences, and set it under General - Clipboard Manipulation:

enter image description here

Noam Manos
  • 2,222
1

As of 0.9.2-1 (Debian Squeeze), parcellite seems to be merging the two clipboards (Primary & Selection), while autocutsel 0.9.0-1 does work most of the time, but fails randomly.

CHEN Cheng
  • 11
  • 1
1

loliclip (current name: xcmenu) does what I was searching for when I bumped into this question. It effectively disables copy on mouse selection by forcing primary buffer to be in sync with clipboard. With default config after start this program you can copy by Ctrl+C (or Ctrl+Insert) and paste it by Ctrl+V (or Shift+Insert).

glebtv
  • 61
0

Problem 2 happens because both copying by selecting and pasting with middle-click move text to/from the same buffer, the primary selection buffer. To change that, I think you would have to modify and recompile Xorg. But I could be wrong.

It would be easier to solve both problems without requiring pasting with middle-click. This would require explicit copy/paste, like what Ctrl + C / Ctrl + V do for desktop apps, but it would work for any X app.

We need a program that copies the X selection to the clipboard, and another program that pastes the clipboard to the cursor. Then you can bind those to some universal key combos. I don't know if there are any programs like that yet.

Lee Taylor
  • 1,506