astrand / xclip

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

-sensitive and "greedy" clients #118

Open jpmg1 opened 3 years ago

jpmg1 commented 3 years ago

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.