I wanted to use CTRLSHIFTC and CTRLSHIFTV for Copy-and-Paste within XTerm and other applications, so I added

XTerm*vt100.translations: #override \
    Shift Ctrl <Key> C: copy-selection(CLIPBOARD) \n\
    Shift Ctrl <Key> V: insert-selection(CLIPBOARD)

to my ~/.Xresources. Copy-and-Paste works fine, as long as I don't close XTerm. Then, all CLIPBOARD content is lost. The same problem arises when using

XTerm*vt100.selectToClipboard: true

where as soon as text gets selected, it is copied directly to CLIPBOARD (instead of to PRIMARY - or maybe to both?) but is only available as long as XTerm is running.

So, I read some more on CLIPBOARD

... but couldn't find a definitive answer. There seem to exist tools, which are able to sync CLIPBOARD and PRIMARY for example. Or make CLIPBOARD content persistent. Or some kind of CLIPBOARD history. But I'm not sure that this is what I'm looking for, here.

For example: If CLIPBOARD content doesn't really leave the application and other programs have to "ask" the original application for the content of CLIPBOARD, it makes sense that this would only be possible as long as this program is running. However, how does the CLIPBOARD selected text from Firefox or Leafpad stay available, even though the program has been closed? How does Firefox/Leafpad do this? They don't use an external tool, do they?!


1 Answer 1


Under X, there isn't really a clipboard. All selections (primary, secondary clipboard) are copied by having the two X clients that are involved talk to each other. (See for example the Wikipedia article for details).

That means if one X client holding the selection is no longer running, the selection is gone.

What you can do is to run another client, e.g. xclipboard, which immediately copies the selection from your xterm (or any other X client) as soon as it is made, and is able to participate in the communication described above even when xterm is no longer running. Of course, now you have to keep xclipboard running ...

I have never observed that Firefox somehow does things differently, but if the selection is indeed available after Firefox is closed, some other X client must still be running, possibly something that is part of your desktop. So yes, Firefox must use some sort of external tool (but as I said, I have not observed this myself. But then, I'm not using a "desktop" in this sense, just fvwm).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.