Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Copy and Paste

<quote who="James Gregory">

> I'm becoming increasingly frustrated at the copy and paste behaviour of my
> linux desktops. Sometimes I can press ctrl-v to paste, other times a
> middle-click will work, sometimes the two behaviours both work but do
> different things. I don't really see the pattern. I understand that this
> is because GTK and X use different copy and paste mechanisms.

No, it's nothing between GTK+ and X -> there *are* two copy and paste
mechanisms in X, but some clients do things differently to others. So
consistency has been pretty badly sabotaged from the start.

> What I want to know is: Is there any way to make this behaviour more
> consistent? Can I disable one of (either of) these mechanisms, so that it
> works one way, all the time? Can I synchronise them? What's the best thing
> to do?

I'm not going to dive into all the technical hocus pocus of it, because
invariably I'll get some reference slightly wrong, so I'll avoid the problem
and explain it at a high level [1].

There's a "copy" action that involves just selecting text. What you know as
"select and middle click" is this one. There's another "copy" action that
works the same way as Windows does. It is usually invoked with "Ctrl-C and
Ctrl-V" (and menu items to that effect). The problem lies in the storage of
these two copy actions, and the way different clients make copies. Really
annoying clients will use both at the same time, so if you Ctrl-C and then
select some text, the selected text will be pasted by the next client. That
is infuriating when it happens, and is difficult to figure out unless you
know you're looking for exactly this inconsistency. Then there's the whole
"copy text and close program... paste to find nothing is there" problem,
which is the inspiration behind so many (really stupid) "clipboard servers"
that grind your machine to a halt when you copy a 10000 cell spreadsheet.


- Jeff

[1] What I'm explaining is the difference between the PRIMARY and SECONDARY
selections and the CLIPBOARD.

linux.conf.au 2007: Sydney, Australia           http://lca2007.linux.org.au/
   "I think we agnostics need a term for a holy war too. I feel all left
                            out." - George Lebl