Is there a Wayland cli utility that copies text to clipboard?
I want to be able to do something like this:
echo "some" > clipboard
Something equivalent to xclip.
bugaevc's wl-clipboard are copy/paste utilities for Wayland:
This project implements two little Wayland clipboard utilities, wl-copy and wl-paste, that let you easily copy data between the clipboard and Unix pipes, sockets, files and so on.
Usage is as simple as:
# copy a simple text message $ wl-copy Hello world!copy the list of files in Downloads
$ ls ~/Downloads | wl-copy
copy an image file
$ wl-copy < ~/Pictures/photo.png
paste to a file
$ wl-paste > clipboard.txt
grep each pasted word in file source.c
$ for word in $(wl-paste); do grep $word source.c; done
copy the previous command
$ wl-copy "!!"
replace the current selection with the list of types it's offered in
$ wl-paste --list-types | wl-copy
Although wl-copy and wl-paste are particularly optimized for plain text and other textual content formats, they fully support content of arbitrary MIME types. wl-copy automatically infers the type of the copied content by running xdg-mime(1) on it. wl-paste tries its best to pick a type to paste based on the list of offered MIME types and the extension of the file it's pasting into. If you're not satisfied with the type they pick or don't want to rely on this implicit type inference, you can explicitly specify the type to use with the --type option.
For all common linux-distributions the package-name is wl-clipboard, so use the command that suits yours (if not already installed):
sudo apt install wl-clipboard # Debian
sudo dnf install wl-clipboard # Fedora
sudo pacman -S wl-clipboard # Arch linux
I've just 'converted' to a Wayland UX, under Plasma (KDE) and so far most things are as usual. The things important for my workflow have highlighted one or two underlying dependencies on X.Org.
Fortunately, I can use CopyQ as my Clipboard manager of choice. CopyQ appears to be a very friendly Wayland supporter; so far, so good.
For CLI copy and paste I now use the following as bash alias commands:
clip ... Capture the current selection.
alias cliq='copyq selection'
alias clip='cliq; echo'
paste ... Emit current clipboard contents.
alias paste='copyq read '
CopyQ can be installed on flathub from:
I've used CopyQ as soon as I installed my first Linux desktop.