Wayland Copy and Paste

A year ago I started to use Sway as Windowmanager based on Wayland and I wrote about screenshotting. Since then I used wl-copy and wl-paste from wl-clipboard quite a bit.

The obvious ones, copy something into the clipboad at the end of a script. The resulting url or the resulting image:

$ wl-copy < /tmp/screen.png
# or
$ cat /tmp/screen.png | wl-copy
# or for a url / string
$ wl-copy "https://madflex.de/wayland-copy-paste"

And a more interesting one: Watch for every copy event and append it at the end of a file:

# using cut
$ wl-paste --watch cut -b 1- > all_entries_with_newlines_at_the_end.txt

# the same but using awk
$ wl-paste --watch awk '{print}' > all_entries_with_newlines_at_the_end_awk.txt