Home » Questions » Computers [ Ask a new question ]

How can I merge the gnome clipboard and the X selection?

How can I merge the gnome clipboard and the X selection?

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!

Asked by: Guest | Views: 331
Total answers/comments: 4
bert [Entry]

"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"
bert [Entry]

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.
bert [Entry]

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).
bert [Entry]

"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."