I wrote a thing called wl-clipboard.

It implements wl-copy and wl-paste commands that copy and paste from stdin/stdout to the clipboard (with a few bells & whistles, e.g. they try to infer the mime type), a lot like pbcopy/pbpaste on macOS or xclip under X11.


$ wl-copy Hello world!
$ ls ~/Downloads | wl-copy
$ wl-copy < ~/Pictures/photo.png
$ wl-paste > clipboard.txt
$ for word in $(wl-paste); do grep $word source.c; done

Source code (C, Meson, GPL v3) is here: github.com/bugaevc/wl-clipboar


I've just released wl-clipboard 1.0 🎉

wl-clipboard is to what xclip is to X11, but much nicer in every way. Check it out at github.com/bugaevc/wl-clipboar

wl-clipboard started out as a proof of concept, turned into something useful that I could announce to the world, and now it's rock-solid and feature-packed.


The 1.0 release features:

• Primary clipboard support! Just pass the --primary flag and it will use the primary clipboard instead of the regular one. All the features are supported, so for example you can copy images into the primary clipboard (wl-copy -p < picture.png) and then paste them with middle-click.


• xdg-shell support; this enables wl-clipboard to work on compositors that lack wl_shell support (such as Sway). wl-clipboard transparently chooses which protocol to use based on what it was built with and what the compositor supports, so you don't have to worry about this.
• Vastly improved type inference in wl-paste. It's now very likely to just do the right thing by default. You can also now specify a type explicitly using the --type option for both wl-copy and wl-paste.


• You can now list all the MIME types the selection is available in with wl-paste --list-types. I don't know of any other tool or app that lets you get this info (on Wayland).
• A bunch of other flags and features (--paste-once, --foreground, --clear, --no-newline).
• Lots of bug fixes.
• A comprehensive man page! Type any of man wl-clipboard, man wl-copy, or man wl-paste to read it.
• wl-clipboard is now packaged in the official Debian repos and in Arch (AUR)! 🎉


I have uncovered a few crashes in wlroots and Mutter while hacking on wl-clipboard, so you'll benefit from stability improvements even if you're not using wl-clipboard itself.

I'm looking forward to more distros shipping wl-clipboard (and upgrading to wl-clipboard 1.0) — if you're the person who can get new packages into :fedora:, take the hint 😉


Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!

We adhere to an adapted version of the TootCat Code of Conduct and follow the Toot Café list of blocked instances. Ash is the admin and is supported by Fuzzface, Brian!, and Daniel Glus as moderators.

Hosting costs are largely covered by our generous supporters on Patreon – thanks for all the help!