Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Jesus saves...but Gretzky gets the rebound!" -- Daniel Hinojosa (hinojosa@hp-sdd)


computers / alt.os.linux.slackware / Re: sync X11 primary selection and clipboard

SubjectAuthor
* sync X11 primary selection and secondary clipboardBen Collver
+* Re: sync X11 primary selection and secondary clipboardGrant Taylor
|`* Re: sync X11 primary selection and secondary clipboardBen Collver
| `* Re: sync X11 primary selection and secondary clipboardJavier
|  `* Re: sync X11 primary selection and secondary clipboardBen Collver
|   +- Re: sync X11 primary selection and clipboardJavier
|   `* Re: sync X11 primary selection and clipboardJavier
|    `* Re: sync X11 primary selection and clipboardBen Collver
|     `* Re: sync X11 primary selection and clipboardJavier
|      `- Re: sync X11 primary selection and clipboardBen Collver
`- Re: sync X11 primary selection and clipboardJavier

1
sync X11 primary selection and secondary clipboard

<slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1197&group=alt.os.linux.slackware#1197

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bencoll...@tilde.pink (Ben Collver)
Newsgroups: alt.os.linux.slackware
Subject: sync X11 primary selection and secondary clipboard
Date: Sat, 7 May 2022 15:29:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
Injection-Date: Sat, 7 May 2022 15:29:34 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8212c7ca75100d0f8127061436f13255";
logging-data="9416"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KVUiXh/t3nmaK3FFJX6ga2Rf6P2v5f6w="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:BGMC1Pac059RXOYwhLGCPlZ8qlM=
 by: Ben Collver - Sat, 7 May 2022 15:29 UTC

Hi,

I would like to synchronize the X11 primary selection and secondary
clipboard. My goal is to select text in rxvt and then use the
Edit/Paste menu to paste it into leafpad. I installed autocutsel
from slackbuilds.org because it looked promising. Then I tried the
following sequence of actions:

* Open rxvt
* Run: autocutsel -debug -verbose -selection PRIMARY
* Open leafpad
* Type text into leafpad: Howdy
* Press Ctrl-A to select the text
* Press Ctrl-X to cut the text
* Open another rxvt
* Run: uname -a
* Double-click to select the word Linux
* In leafpad, click Edit, Paste
It pastes: Howdy

I expected leafpad to paste "Linux".

When I run "cutsel cut" it outputs "Linux".
When I run "xclip -out -selection primary" it outputs "Linux".

When I run "cutsel sel" it outputs "Howdy".
When I run "xclip -out -selection clipboard" it outputs "Howdy".

Below is the text output from the autocutsel process:

bash-5.1$ autocutsel -debug -verbose -selection PRIMARY
autocutsel v0.10.1
Selection changed: "Howdy"
New value saved: "Howdy"
sel -> cut: "Howdy"
Updating buffer
Selection changed: "Linux"
New value saved: "Linux"
sel -> cut: "Linux"
Updating buffer

The second-to-the-last line of output led me to expect that
autocutsel copied the word Linux from the selection into the
clipboard, but on the contrary, the clipboard still contains the word
Howdy.

Can anyone recommend a different solution to synchronize my primary
selection to the secondary clipboard?

Thanks!
-Ben

Re: sync X11 primary selection and secondary clipboard

<t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1209&group=alt.os.linux.slackware#1209

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.alpha.home.tnetconsulting.net!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: alt.os.linux.slackware
Subject: Re: sync X11 primary selection and secondary clipboard
Date: Wed, 11 May 2022 11:06:39 -0600
Organization: TNet Consulting
Message-ID: <t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net>
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 May 2022 17:06:32 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251";
logging-data="7755"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
Content-Language: en-US
 by: Grant Taylor - Wed, 11 May 2022 17:06 UTC

On 5/7/22 9:29 AM, Ben Collver wrote:
> Hi,

Hi,

> I would like to synchronize the X11 primary selection and secondary
> clipboard.

I'm not sure if you're wanting something that you manually initiate or
is automatically initiated in the background.

I use `xsel` do to this manually.

> Can anyone recommend a different solution to synchronize my primary
> selection to the secondary clipboard?

You seem to be missing a piece of the puzzle. X11 traditionally has
three buffers (in this context);

- primary
- secondary
- clipboard

Many GUI programs that originated on X11 use the clipboard. The primary
selection is usually incidentally altered as a precursor to altering the
clipboard.

I've only heard tell of one program, emacs, that actually utilizes the
secondary selection, save for utilities specifically meant work with
primary / secondary / clipboard.

XTerm uses the primary selection for it's copy and paste actions by default.

I'd encourage you to install, play with, and skim the man page for the
`xsel` command.

I've got the following aliases defined to make working with xsel more
convenient.

b2b='xsel -ob | xsel -ib' # remove formatting from clipboard
b2p='xsel -ob | xsel -ip' # copy clipboard to primary
ib='xsel -ib' # copy STDIN to clipboard
is='xsel -is' # copy STDIN to secondary
ob='xsel -ob' # copy clipboard to STDOUT
op='xsel -op' # copy primary to STDOUT
opf='xsel -op | fmt -w $COLUMNS' # copy primary to STDOUT via fmt
os='xsel -os' # copy secondary to STDOUT
p2b='xsel -op | xsel -ib' # copy primary to clipboard
p2p='xsel -op | xsel -ip' # remove formatting from primary

--
Grant. . . .
unix || die

Re: sync X11 primary selection and secondary clipboard

<slrnt8lksu.bh3.bencollver@svadhyaya.localdomain>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1232&group=alt.os.linux.slackware#1232

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bencoll...@tilde.pink (Ben Collver)
Newsgroups: alt.os.linux.slackware
Subject: Re: sync X11 primary selection and secondary clipboard
Date: Mon, 23 May 2022 00:22:20 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <slrnt8lksu.bh3.bencollver@svadhyaya.localdomain>
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
<t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net>
Injection-Date: Mon, 23 May 2022 00:22:20 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="43f645b182551ba995377bdc56966006";
logging-data="16236"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196XExhq1Livdri5SIyhaorPFFLn63lwmk="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:I5f+EKW+sfr/y7aj5MOjDhvVd70=
 by: Ben Collver - Mon, 23 May 2022 00:22 UTC

On 2022-05-11, Grant Taylor <gtaylor@tnetconsulting.net> wrote:
> I'm not sure if you're wanting something that you manually initiate or
> is automatically initiated in the background.
>
> You seem to be missing a piece of the puzzle. X11 traditionally has
> three buffers (in this context);
> - primary - secondary - clipboard

Thanks! I should have phrased it more carefully: I would like to
automatically synchronize the X11 primary and clipboard. Your b2p
and p2b aliases do what i want, except manually. This can also be
manually accomplished using xclip.

b2p='xclip -selection clipboard -out | xclip -selection primary -in'
p2b='xclip -selection primary -out | xclip -selection clipboard -in'

I had hoped that the autocutsel package would automate this process,
but it did not work as i expected.

Re: sync X11 primary selection and secondary clipboard

<GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1234&group=alt.os.linux.slackware#1234

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 23 May 2022 21:16:22 -0500
From: inva...@invalid.invalid (Javier)
Subject: Re: sync X11 primary selection and secondary clipboard
Newsgroups: alt.os.linux.slackware
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain> <t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net> <slrnt8lksu.bh3.bencollver@svadhyaya.localdomain>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk>
Date: Mon, 23 May 2022 21:16:23 -0500
Lines: 35
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-9I5A3Ws7Kybfzziw3ZlDSn3z6VaRqf1ZmO4+5vuXSn98zWSXRPoBm1g/H8BPxl8FAih/1sYRa+lXeVR!rpYDImFVNz9cwl5K2MGfKE8Rgzl0t3SRwByV67NHSn6TpE+uvhAEhigmDHYAdXi88CAXIIt/S5vi!sj7kbHAs4Miq7YIQ+WpFtRGM
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2535
 by: Javier - Tue, 24 May 2022 02:16 UTC

Ben Collver <bencollver@tilde.pink> wrote:
> Thanks! I should have phrased it more carefully: I would like to
> automatically synchronize the X11 primary and clipboard. Your b2p
> and p2b aliases do what i want, except manually. This can also be
> manually accomplished using xclip.
>
> b2p='xclip -selection clipboard -out | xclip -selection primary -in'
> p2b='xclip -selection primary -out | xclip -selection clipboard -in'
>
> I had hoped that the autocutsel package would automate this process,
> but it did not work as i expected.

In xterm you can configure it to put the selected text automatically
on the clipboard.

From xterm(1)

selectToClipboard (class SelectToClipboard)
Tells xterm whether to use the PRIMARY or CLIPBOARD for SELECT
tokens in the selection mechanism. The set-select action can
change this at runtime, allowing the user to work with programs
that handle only one of these mechanisms. The default is
“false”, which tells it to use PRIMARY.

or enable the option in the VT menu accesed with Ctrl+middle mouse button
or enable it with XResources.

xterm -xrm '*selectToClipboard: true'

Or even synchronize both primary and clipboard with

xterm -xrm '*VT100*translations: #override \n\ <BtnUp> : select-end(PRIMARY, CLIPBOARD)'

rxvt as asked in the OP I don't believe it those options.

Re: sync X11 primary selection and secondary clipboard

<slrnt8puqs.uks.bencollver@svadhyaya.localdomain>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1235&group=alt.os.linux.slackware#1235

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bencoll...@tilde.pink (Ben Collver)
Newsgroups: alt.os.linux.slackware
Subject: Re: sync X11 primary selection and secondary clipboard
Date: Tue, 24 May 2022 15:36:28 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <slrnt8puqs.uks.bencollver@svadhyaya.localdomain>
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
<t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net>
<slrnt8lksu.bh3.bencollver@svadhyaya.localdomain>
<GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk>
Injection-Date: Tue, 24 May 2022 15:36:28 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a456d174267e579f0596254cf48e8b80";
logging-data="20785"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5tKw5P5Vtn9i07K4nKsMr+xTcdqEdSTM="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:/g25377X6wOiqACPjMVoCuCOXD4=
 by: Ben Collver - Tue, 24 May 2022 15:36 UTC

On 2022-05-24, Javier <invalid@invalid.invalid> wrote:
> In xterm you can configure it to put the selected text automatically
> on the clipboard.

Thanks! That looks useful for xterm. I that it is simple to configure.
I see that the urxvtperl man page mentions hooks for on_sel_grab() and
on_tt_paste(), which could be used to configure a similar behavior.

I will keep an eye out for something that can work system-wide.

Re: sync X11 primary selection and clipboard

<0_ednf-h-9HWcBP_nZ2dnUU7-SfNnZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1237&group=alt.os.linux.slackware#1237

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 25 May 2022 22:00:27 -0500
From: inva...@invalid.invalid (Javier)
Subject: Re: sync X11 primary selection and clipboard
Newsgroups: alt.os.linux.slackware
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
Message-ID: <0_ednf-h-9HWcBP_nZ2dnUU7-SfNnZ2d@brightview.co.uk>
Date: Wed, 25 May 2022 22:00:27 -0500
Lines: 49
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-0QRvWTaxTwfjoJwJYIMYjRZ4gh7dO9nJp3kCu7SM89re+MU47lvFMALPCLVO6iAzQwT+aFt4or2AhUk!ktYhDs8YWGHZbHFQ/itJt94y8iedANN0u3z2G50ad/1ptEs84RP4mG4nNcPkIm04kgWUK0kF/c7W!2YymXjUZpDx42I653llVuntP
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2494
 by: Javier - Thu, 26 May 2022 03:00 UTC

Ben Collver <bencollver@tilde.pink> wrote:
>
> * Open rxvt
> * Run: autocutsel -debug -verbose -selection PRIMARY
> * Open leafpad
> * Type text into leafpad: Howdy
> * Press Ctrl-A to select the text
> * Press Ctrl-X to cut the text
> * Open another rxvt
> * Run: uname -a
> * Double-click to select the word Linux
> * In leafpad, click Edit, Paste
> It pastes: Howdy
>
> I expected leafpad to paste "Linux".
>
> When I run "cutsel cut" it outputs "Linux".
> When I run "xclip -out -selection primary" it outputs "Linux".
>
> When I run "cutsel sel" it outputs "Howdy".
> When I run "xclip -out -selection clipboard" it outputs "Howdy".
>
> Below is the text output from the autocutsel process:
>
> bash-5.1$ autocutsel -debug -verbose -selection PRIMARY
> autocutsel v0.10.1
> Selection changed: "Howdy"
> New value saved: "Howdy"
> sel -> cut: "Howdy"
> Updating buffer
> Selection changed: "Linux"
> New value saved: "Linux"
> sel -> cut: "Linux"
> Updating buffer
>
> The second-to-the-last line of output led me to expect that
> autocutsel copied the word Linux from the selection into the
> clipboard, but on the contrary, the clipboard still contains the word
> Howdy.

The problem is that autocutsel/cutsel act on the cutbuffers which is
yet another different thing to primary/clipboard/secondary. In the
olden times of X-windows they were the old-fashioned way to exchange
text between selections before the primary selection existed.

https://www.nongnu.org/autocutsel/
https://manpages.debian.org/testing/autocutsel/autocutsel.1.en.html

Re: sync X11 primary selection and clipboard

<daidnSfy0Mx_bBP_nZ2dnUU7-dfNnZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1238&group=alt.os.linux.slackware#1238

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 25 May 2022 22:20:02 -0500
From: inva...@invalid.invalid (Javier)
Subject: Re: sync X11 primary selection and clipboard
Newsgroups: alt.os.linux.slackware
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain> <t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net> <slrnt8lksu.bh3.bencollver@svadhyaya.localdomain> <GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk> <slrnt8puqs.uks.bencollver@svadhyaya.localdomain>
Message-ID: <daidnSfy0Mx_bBP_nZ2dnUU7-dfNnZ2d@brightview.co.uk>
Date: Wed, 25 May 2022 22:20:02 -0500
Lines: 23
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-5uSIlC9khvlvbaqNWF4QRtV3HbhWlt4+2BrYnU/HIoppsbpAe5dtRgFRQEltLmovmo28fys4sSLIJDT!QjB347TWJpsVZVVAx2S+ho6ATe1bFV57xUpgr0oJyRh4Z/3TQbGL+n+mQzBoH0zayJbhbafsqfl8!svBKD+ceU9BCf9zURTesCuDp
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 1986
 by: Javier - Thu, 26 May 2022 03:20 UTC

Ben Collver <bencollver@tilde.pink> wrote:
> On 2022-05-24, Javier <invalid@invalid.invalid> wrote:
>> In xterm you can configure it to put the selected text automatically
>> on the clipboard.
>
> Thanks! That looks useful for xterm. I that it is simple to configure.
> I see that the urxvtperl man page mentions hooks for on_sel_grab() and
> on_tt_paste(), which could be used to configure a similar behavior.
>
> I will keep an eye out for something that can work system-wide.

I didn't know urxvtperl existed. It looks much more powerful than
xterm '*VT100*translations', which only gives access to a few predefined
functions.

I was just checking urxvt-extensions(1) and there is one that does
what the OP was asking for:

urxvt -pe selection-to-clipboard

selection-to-clipboard - copy the selection to the clipboard each time
a selection is made

Re: sync X11 primary selection and clipboard

<GJ-dnS038qAhaxP_nZ2dnUU7-aPNnZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1239&group=alt.os.linux.slackware#1239

  copy link   Newsgroups: alt.os.linux.slackware comp.os.linux.x
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 25 May 2022 22:40:44 -0500
From: inva...@invalid.invalid (Javier)
Subject: Re: sync X11 primary selection and clipboard
Newsgroups: alt.os.linux.slackware,comp.os.linux.x
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain> <t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net> <slrnt8lksu.bh3.bencollver@svadhyaya.localdomain> <GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk> <slrnt8puqs.uks.bencollver@svadhyaya.localdomain>
Message-ID: <GJ-dnS038qAhaxP_nZ2dnUU7-aPNnZ2d@brightview.co.uk>
Date: Wed, 25 May 2022 22:40:44 -0500
Lines: 23
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-4gQOfulvkic7c3EbDSn+/cobFY/vVdywL6YBDIUXvUqSFOHcypGsycPG4u+TilzWEugSGJvmo+a4a4o!K5h0sImAvwkxX1GPqxMAo3xPZ2FM2s9YUNXTHaYJWJEybM2kjbBQkNPdcMYzv8VRVMpQSmWksiG2!ORtMmQpNkVJU6wSV9m2JCBaJ
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 1805
 by: Javier - Thu, 26 May 2022 03:40 UTC

Ben Collver <bencollver@tilde.pink> wrote:
> I will keep an eye out for something that can work system-wide.

clipnotify looks very close to what you need.

https://github.com/cdown/clipnotify/blob/master/clipnotify.c

The only problem is that it notifies both changes in clipboard and
primary without telling which selection was actually changed.

Just comment this line in the source:

/* XFixesSelectSelectionInput(disp, root, clip, XFixesSetSelectionOwnerNotifyMask); */

and call it primarynotify.c

Compile it and run in the shell

while primarynotify; do
xclip -o -selection primary | xclip -i -selection clipboard
done

NOTE: I have not tested this.

Re: sync X11 primary selection and clipboard

<slrntb1si1.28l.bencollver@svadhyaya.localdomain>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1307&group=alt.os.linux.slackware#1307

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bencoll...@tilde.pink (Ben Collver)
Newsgroups: alt.os.linux.slackware
Subject: Re: sync X11 primary selection and clipboard
Date: Mon, 20 Jun 2022 22:19:46 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <slrntb1si1.28l.bencollver@svadhyaya.localdomain>
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
<t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net>
<slrnt8lksu.bh3.bencollver@svadhyaya.localdomain>
<GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk>
<slrnt8puqs.uks.bencollver@svadhyaya.localdomain>
<GJ-dnS038qAhaxP_nZ2dnUU7-aPNnZ2d@brightview.co.uk>
Injection-Date: Mon, 20 Jun 2022 22:19:46 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="99bd2dafc0811fd053e4c577302e1be9";
logging-data="26988"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187whTMFphP7U4L6UpahiGd6SyIZwegXfo="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:IcrYWBvvdtMh4qiH+/Wb3BcZPn0=
 by: Ben Collver - Mon, 20 Jun 2022 22:19 UTC

On 2022-05-26, Javier <invalid@invalid.invalid> wrote:
> Ben Collver <bencollver@tilde.pink> wrote:
> clipnotify looks very close to what you need.
> https://github.com/cdown/clipnotify/blob/master/clipnotify.c

Hi Javier,

Your example worked as posted. :-)

I changed clipnotify.c as shown below [1]. Then i ran the script below.
This accomplishes what i was wishing for: bidirectional synchronization.
When the primary selection is made, it is copied to the clipboard. When
the clipboard is filled, it is copied to the primary selection.

while :
do
./clipnotify && \
(echo p2c; xclip -o -selection primary |\
xclip -i -selection clipboard) || \
(echo c2p; xclip -o -selection clipboard |\
xclip -i -selection primary)
done

Thanks!
-Ben

[1]
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
#include <stdio.h>
#include <stdlib.h>

#define EXIT_PRIMARY 0
#define EXIT_CLIPBOARD 1

int main(void) {
Display *disp;
Window root;
Atom clip;
Atom selection;
XEvent evt;

disp = XOpenDisplay(NULL);
if (!disp) {
fprintf(stderr, "Can't open X display\n");
exit(1);
}

root = DefaultRootWindow(disp);

clip = XInternAtom(disp, "CLIPBOARD", False);

XFixesSelectSelectionInput(disp, root, XA_PRIMARY,
XFixesSetSelectionOwnerNotifyMask);
XFixesSelectSelectionInput(disp, root, clip,
XFixesSetSelectionOwnerNotifyMask);

XNextEvent(disp, &evt);
selection = ((XFixesSelectionNotifyEvent *)&evt)->selection;
XCloseDisplay(disp);
if (selection == XA_PRIMARY) {
exit(EXIT_PRIMARY);
} else {
exit(EXIT_CLIPBOARD);
}
}

Re: sync X11 primary selection and clipboard

<dr6dndlNtc9l7yX_nZ2dnUU7-SednZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1316&group=alt.os.linux.slackware#1316

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 26 Jun 2022 09:53:44 -0500
From: inva...@invalid.invalid (Javier)
Subject: Re: sync X11 primary selection and clipboard
Newsgroups: alt.os.linux.slackware
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain> <t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net> <slrnt8lksu.bh3.bencollver@svadhyaya.localdomain> <GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk> <slrnt8puqs.uks.bencollver@svadhyaya.localdomain> <GJ-dnS038qAhaxP_nZ2dnUU7-aPNnZ2d@brightview.co.uk> <slrntb1si1.28l.bencollver@svadhyaya.localdomain>
Message-ID: <dr6dndlNtc9l7yX_nZ2dnUU7-SednZ2d@brightview.co.uk>
Date: Sun, 26 Jun 2022 09:53:44 -0500
Lines: 23
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-r0wdOcr1QcGZi+MIgpqpHrRlSsqpzL/vAwVXQHdHV4lBsAIhr+HSgRkg7kM9UsGz1oB70Ja+Tp1Ktg+!ksJbhULKFOA73W1JN9wAfa8t4eaUYutRyZcNs3bQURP+7u1huZiEDYNYiBYR3psR+o16R0w3HE30!HVd7ETuuD5b+q6SQ9YNz2m6dZII=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2080
 by: Javier - Sun, 26 Jun 2022 14:53 UTC

Ben Collver <bencollver@tilde.pink> wrote:
> On 2022-05-26, Javier <invalid@invalid.invalid> wrote:
>> Ben Collver <bencollver@tilde.pink> wrote:
>> clipnotify looks very close to what you need.
>> https://github.com/cdown/clipnotify/blob/master/clipnotify.c
>
> Hi Javier,
>
> Your example worked as posted. :-)
>
> I changed clipnotify.c as shown below [1]. Then i ran the script below.
> This accomplishes what i was wishing for: bidirectional synchronization.
> When the primary selection is made, it is copied to the clipboard. When
> the clipboard is filled, it is copied to the primary selection.

Congrats for making it work bidirectionally.

BTW you can also implement the same thing in wish (windowing shell,
which is part of TCL) and is interpreted, so you save the compilation step.
Have a look at this:

https://github.com/apenwarr/xclipsync

Re: sync X11 primary selection and clipboard

<slrntbgtkq.3ss.bencollver@svadhyaya.localdomain>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1317&group=alt.os.linux.slackware#1317

  copy link   Newsgroups: alt.os.linux.slackware
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bencoll...@tilde.pink (Ben Collver)
Newsgroups: alt.os.linux.slackware
Subject: Re: sync X11 primary selection and clipboard
Date: Sun, 26 Jun 2022 15:10:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <slrntbgtkq.3ss.bencollver@svadhyaya.localdomain>
References: <slrnt7d42b.l7m.bencollver@svadhyaya.localdomain>
<t5gqeo$7ib$1@tncsrv09.home.tnetconsulting.net>
<slrnt8lksu.bh3.bencollver@svadhyaya.localdomain>
<GcKdndEg7plqohH_nZ2dnUU7-fnNnZ2d@brightview.co.uk>
<slrnt8puqs.uks.bencollver@svadhyaya.localdomain>
<GJ-dnS038qAhaxP_nZ2dnUU7-aPNnZ2d@brightview.co.uk>
<slrntb1si1.28l.bencollver@svadhyaya.localdomain>
<dr6dndlNtc9l7yX_nZ2dnUU7-SednZ2d@brightview.co.uk>
Injection-Date: Sun, 26 Jun 2022 15:10:25 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="3a3dc0586f8b11d095289693bfc69efe";
logging-data="4150147"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ACCw2rgkSEsxfVNxuO1nsdWCjlIVGHkQ="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:/K9tE+aGHk32JIh9hTkUERl29cE=
 by: Ben Collver - Sun, 26 Jun 2022 15:10 UTC

On 2022-06-26, Javier <invalid@invalid.invalid> wrote:
> Congrats for making it work bidirectionally.
>
> BTW you can also implement the same thing in wish (windowing shell...
> https://github.com/apenwarr/xclipsync

Nice find, thanks!

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor