Hi Thorsten,

On Thu, Oct 17, 2013 at 08:18:47PM +0000, Thorsten Glaser wrote:
> retitle 725653 --clip copies to CLIPBOARD, I'd prefer PRIMARY selection
> tags 725653 + patch

Thanks for this patch and thanks to Colin Watson for carrying it. It
scratches my itch as well.

> I???ve decided to just copy to both. The attached patch ???
> untested of course ;-) ??? does that; xsel(1) is able to
> keep it in memory by forking a dæmon subprocess that???s
> ended as soon as it???s no longer needed.

I was wondering whether we could exploit the existence of the subprocess
in a useful way. Reading the manual page, I presumed that passing the -t
switch could terminate an xsel process after a specific amount of time,
but this seems not to be the case. When wrapping xsel --nodetach in
timeout or timelimit, we can ensure that the buffer is gone. This would
also alleviate the need to launch a secondary xsel again forking to
background, since - it seems - the behaviour of a dieing xsel process is
to restore the previous clipboard contents, precisely what is desired
here.

So maybe all the hackery for restoration including the sleep 45 could be
replaced by something akin to

printf '%s' "$1" | timeout 45 xsel -n -i -b &
printf '%s' "$1" | timeout 45 xsel -n -i -p &

further simplifying the code at the cost of an additional dependency.

What do you think?

Helmut


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to