25

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?

2 Answers 2

19

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

  • "clipboard" 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.
3
  • I'm not sure that secondary was ever really used... Oct 22, 2010 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, 2010 at 18:04
  • Right. It's just my preferred configuration :)
    – singpolyma
    Oct 29, 2010 at 20:51
13

Check here and here.

tl;dr: See Singpolyma's post.

1
  • 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, 2019 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .