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

61

19

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

Posted 2009-11-09T20:57:26.427

Reputation: 1 147

I think the problem is exactly because you tried to join them. now you are probably overwritting the ctrl+c one with selections. If you force yourself to use only Ctrl+c/Ctrl+v, then you can either ignore selection/middle+click or use it as an isolated, alternative one. Just never use selection/middle+click (or shift+ins). stick with ctrl+c/ctrl+v and you don't have the problem – gcb – 2015-06-08T07:24:03.750

It's been 3 years. Do we have solution to this problem? – Varun – 2013-03-20T13:05:28.463

Nope. For various other reasons, I've switched to KDE recently. klipper is acceptable for kde + synergy, but I know of no usable solution for gnome + synergy. Problems with autocutsel, parcellite and glipper are all laid out in existing answers and comments on this question. – TREE – 2013-03-20T17:16:40.770

Answers

31

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

Posted 2009-11-09T20:57:26.427

Reputation: 2 803

1Hell yeah ! add this to my .bashrc – Natim – 2013-02-26T10:47:22.190

27

"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

Warren Noronha

Posted 2009-11-09T20:57:26.427

Reputation: 371

3parcellite appears to successfully merge the clipboards. It does not solve the latter problem, which is pasting over a selection. I like that I can paste a single buffer with either control-v or middle button. I do not like (and would like to disable) selection as copy. – TREE – 2010-04-12T13:28:35.540

Autocutsel works inconsistently (or not at all). It has been so frustrating, thanks for this. – NSAutomaton – 2016-05-16T13:00:45.027

1sudo yum install parcellite for RHEL / CentOS – Noam Manos – 2018-01-09T11:58:06.350

FYI, parcellite has cool feature - history of copied text. To activate auto-paste from history dialog, you should also install xdotool – Noam Manos – 2018-01-25T13:52:30.867

This one worked for me. – Farhan.K – 2018-03-12T10:36:43.057

4

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 

Dale

Posted 2009-11-09T20:57:26.427

Reputation: 41

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

Posted 2009-11-09T20:57:26.427

Reputation: 5 742

I tried Glipper, which had a decent workaround for the selection problem: when you've destroyed your previous selection by selecting something else, Glipper lets you access the history and get back what you had. However, it interferes with Synergy clipboard sharing, which is a non-starter. :( – TREE – 2010-07-02T12:33:19.463

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

Posted 2009-11-09T20:57:26.427

Reputation: 11

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

Posted 2009-11-09T20:57:26.427

Reputation: 61

1

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

DaveParillo

Posted 2009-11-09T20:57:26.427

Reputation: 13 402

This looked really promising, but running it doesn't appear to change anything. :( – TREE – 2009-11-12T20:36:24.013

Can you give an exact example? Copy from X (using ctrl-C) to Y (using middle mouse button)? I think I may not understand your exact situation. – DaveParillo – 2009-11-13T06:12:11.923

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.

user39142

Posted 2009-11-09T20:57:26.427

Reputation: 1

I don't think it require recompiling xorg because klipper does it perfectly.. – neutrinus – 2015-11-04T08:41:48.760

0

copyq seems to do this as well.

Hielke Walinga

Posted 2009-11-09T20:57:26.427

Reputation: 101