14

man xclip says:

 -selection     specify which X selection to use, options are 
                "primary" to use XA_PRIMARY (default), "secondary" 
                for XA_SECONDARY or "clipboard" for XA_CLIPBOARD

Why do we have 3 types of X-Selections? What are their purposes?

9

Historical partly. I'm not sure secondary is used for anything at all anymore.

"cliboard" is what is used by most ctrl+x/c/v, it is the clipboard you put things into on purpose

"primary" is what holds whatever text is currently selected, it is how X keeps track of what is selected and conveniently may be pasted by middle clicking (or, if you're awesome, clicking right and left buttons at the same time) or by shift+insert in xterm

  • I'm not sure that secondary was ever really used... – Ignacio Vazquez-Abrams Oct 22 '10 at 20:34
  • Left and right clicking at the same time only works if your system is set up, so that left+right click simulates a middle-click, right? – sepp2k Oct 28 '10 at 18:04
  • Right. It's just my preferred configuration :) – singpolyma Oct 29 '10 at 20:51
8

Check here and here.

tl;dr: See Singpolyma's post.

  • Great links! Thanks to the 1st one I finally understand why my clipboard is empty when I copy text to it in vim and then close vim. And 2nd explained how it is possible that I can copy-paste formatted text. Discussed implementation details and corner cases explained to me why X selection is so tricky. – WloHu May 24 at 10:24

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.