astrand / xclip

Command line interface to the X11 clipboard
GNU General Public License v2.0
1.07k stars 75 forks source link

Examples of strange behaviour #21

Open astrand opened 8 years ago

astrand commented 8 years ago

1) % xclip -i -sel clip

This just blocks (makes sense)

2) % printf | xclip -i -sel clip

This returns immediately (makes sense)

3) % xclip -i -sel clip -verbose Connected to X server. Using selection: XA_CLIPBOARD Using UTF8_STRING.

Blocks here

4) % printf | xclip -i -sel clip -verbose Connected to X server. Using selection: XA_CLIPBOARD Using UTF8_STRING. Waiting for selection requests, Control-C to quit Waiting for selection request number 1

Now I can go to another application, copy text to the clipboard and xclip will exit as soon as I do the copying. This is very useful, because it provides an event driven hook for changes to the X clipboard.

5) printf | xclip -i -sel clip -quiet Waiting for selection requests, Control-C to quit Waiting for selection request number 1

Behaves the same as 4.

Why is the printf necessary? Why doesn't 3) behave like 4)?

Why is one of -quiet or -verbose necessary? Why doesn't 2) behave like 5)?

% xclip -version xclip version 0.12 Copyright (C) 2001-2008 Kim Saunders et al. Distributed under the terms of the GNU GPL

% uname -rs FreeBSD 10.2-STABLE

The inconsistencies are likely something I'm misunderstanding. Thanks for xclip. It's a nice tool.

Reported by: joeymingrone

Original Ticket: xclip/bugs/10

astrand commented 8 years ago

I didn't reallize that 4) blocks other applications from accessing the clipboard. So, it's not useful for the event driven hook I described above.

Original comment by: joeymingrone