Le 18/11/2020 à 10:11, Ludovic Bellière a écrit :
> Whenever you select something, the content is then sent to the PRIMARY
> selection. As such, selecting text would be the equivalent of MS
> Windows's CTRL-C. Content is then accessed using the middle mouse
> button.
>
> Whenever the user specifically request the content to be copied, with
> CTRL-C, the content would then be sent to the CLIPBOARD selection.
> Accessed then using CTRL-V.
>
> There can be any number of selections (ie. buffers containing your
> data), but we usually needs to take care of only three: PRIMARY,
> SECONDARY and CLIPBOARD.
>
> Writing this email, whenever I select some text it then becomes
> available across all windows through the click of the middle mouse
> button so long the text remains selected. If I want a more permanent
> buffer, I would then need to use CTRL-C.
>
> See: https://tronche.com/gui/x/icccm/sec-2.html#s-2.6
>
> There is another behavior called cut buffers. Cut buffers store data
> regardless of the state of the window from which it originates. These
> behave like the PRIMARY selection, selecting text would then send the
> content to a cut buffer. I believe terminals, such as xterm, make use
> of the cut buffer mechanism. The guake terminal, however, does not and
> uses the PRIMARY selection instead without clearing it after the text
> is no longer highlighted.
>
> See: https://tronche.com/gui/x/icccm/sec-3.html#s-3
>
>> I've tried pastebin managers in the past, but they seemed to make
>> things worse.
>>
>> If anybody knows of a pastebin manager (but not associated with KDE)
>> that makes cut and paste on any Linux X (not associated with a
>> specific wm/de (Window Manager/Desktop Environment)), please let me
>> know.
>>
> That does not exists per say. The clipboard is managed by the X window
> system for very good reason, one of them is to enable the copied
> content to be shared between applications. The behavior of the
> clipboard may be different depending on what takes ownership of it,
> which is why you may have found different behavior with different set
> of software.
>
> Different software can take ownership of the selections, and those
> software can behave differently. For instance claws-mail will purge the
> PRIMARY selection whenever I stop selecting text within the window,
> where as guake will not. That can lead to some weird stuff.
>
> For instance:
> - I select text within xterm -> sent to a cut buffer and PRIMARY
> - Cut buffers are not available within claws mail, PRIMARY is.
> - I select something in claws mail, PRIMARY gets cleared
> - The content of the cut buffer is still available to xterm, so long
> PRIMARY is empty.
>
> As for the clipboard manager, I use xfce4-clipman. It handle the CTRL-C
> requests and store a history. Leaves the PRIMARY selection alone. There
> is also a xclipboard, but that software changes the behavior of the
> selections.
>
Thanks a lot for these detailed explanations, though it's missing
how the SECONDARY is used.
A lot needs to be studied to understand the behaviour of cut/paste.
Since most of us only use a finite number of applications, it therefore
seems easier to rely on an empirical knowledge of the behaviour of each app.
AFAIR , Windows doesn't allow cut/paste across different
applications. But I confess I didn't use this OS for decades.
-- Didier