astrand/xclip

-sensitive and "greedy" clients

jpmg1 opened this issue · 0 comments

jpmg1 commented

A problem with the current implementation of -sensitive is that a typical X desktop environment nowadays includes multiple applications that automatically request the clipboard as soon as xclip makes it available. (The culprits in my case are xfdesktop and gnome-terminal).
I've re-implemented this slightly, so that there is a window of 50ms immediately after xclip makes the selection available, in which it will return a dummy string to any selection request; only after that does it return the actual content to the next requester, and then shut down.
My current implementation is slightly non-portable (I used timersub() out of laziness), but that's fairly easily worked around.