orangesquid (os) wrote,

xa_primary, xa_clipboard, and xa_cut_buffer0

If you haven't read about selections and cut-buffers, at least take a look at the overview on wikipedia.

I've been wondering why some apps do the things they do for quite some time, and I think I'm beginning to understand a little better why now, after a few observations:
gtk+1 hilite    primary+clipboard                 
gtk+1 getclip   removed from primary,clipboard
gtk+1 getprim   still on primary+clipboard
gtk+1 unsel     still on primary+clipboard
gtk+1 midclk    paste from primary
gtk+2 hilite    primary+clipboard                 
gtk+2 getclip   removed from primary,clipboard
gtk+2 getprim   still on primary+clipboard
gtk+2 unsel     removed from primary+clipboard
gtk+2 midclk    paste from primary  
xterm hilite    primary+clipbard+cb0             
xterm getclip   removed from primary,clipboard, auto-unsel
xterm getprim   still on primary+clipboard+cb0
xterm unsel     removed from primary+clipboard
xterm midclk    paste from primary
motif hilite    primary+clipboard+cbrotate+cb0
motif getprim   still on primary+clipboard+cb0
motif getclip   removed from primary+clipboard, auto-unsel
motif unsel     removed from primary+clipboard
motif midclk    paste from primary if avail, else cb0

More observations to come... fltk, Qt, etc, whenever I get the time. For now, this is all I need to cut+paste code snippets without headaches...
You'll need xsel to read XA_{PRIMARY,SECONDARY,CLIPBOARD} and xcb to read XA_CUT_BUFFER[0-7].
Be careful when reading XA_CLIPBOARD!
If you want to write to XA_{PRIMARY,SECONDARY,CLIPBOARD,CUT_BUFFER0}, get xclip.
Don't forget three useful tools are xcutsel, xclipboard, and xcb (in GUI mode). The first two are in about every distro (or at least easy to find).
Tags: clipboard, cut buffers, programming, x11
  • Post a new comment


    default userpic

    Your IP address will be recorded