On 29/09/2026 16:49, Franco Martelli wrote:
On 29/09/26 at 15:24, [email protected] wrote:
On Tue, Sep 29, 2026 at 03:07:38PM +0200, Franco Martelli wrote:
Hello,
I'd like to write the content of a .txt file to the X11+KDE
clipboard, in
order to do that I defined an "alias":
Xclip is your friend:
xclip < youefile
(Yes, yes, you can also "cat yourfile | xclip", but, although
a common idiom, it comes from the department of redundancy
department [1]).
Note that there are three selections to choose from (primary,
secondary and clipboard: applications are sometime confused
which one is "the right one") -- see the xclip man page for
details.
Cheers
[1] https://porkmail.org/era/unix/award
Yes I know about "xclip" but I would be liked to use the Dbus channel
so I save another package on the system: xclip or xsel.
In addiction using Dbus may work also with Wayland (I suppose) when
I'll migrate to it next year with Forky.
Just to add to the richness of the mailing list archive, the equivalent
of xclip on wayland is called "wl-copy".
And the nice thing about xclip and wl-copy is that they work at a lower
level than your desktop environment, so work whether you're on KDE or
GNOME or sway or i3 or ...
And, if you don't want either, you could always ask your terminal to
copy the text to your clipboard on your behalf:
osc52() {
printf '\033]52;c;';
base64 -w0;
printf '\a';
}
That can work through tmux, through SSH and so on.
Kind regards,