why i made wlsnarf

wlsnarf - extensible clipboard cli for wayland

ever wondered how this weird piece of software came into being? well ponder no longer!

found a neat writeup introducing wlsnarf while looking through my notes, originally this was gonna be in the README but in true notchoc fashion got too long and rambly

still it's a pretty good explanation so

enjoy!

-

I had been using wl-clipboard1 with clipman2 for quite some time. however, when I tried hooking up my screenshot utility to copy to the clipboard, wl-clipboard would always classify it as text, even when I specified the mimetype. this caused clipman to hang while trying to save the image to its history, so any new copies would be ignored and my clipboard would be effectively stuck copying the image data until I killed the offending processes.

I tried fixing this by having wl-clipboard copy the image along with some text so clipman wouldn't freeze, but unfortunately wl-clipboard didn't support different content sources3. I dug into the code and found out that wl-clipboard was actually doing a lot of stuff behind the scenes to identify and convert mimetypes, which didn't feel unix-y.

taking inspiration from plan 9, I came up with a filesysytem-based api. since each mimetype corresponds to one data source, the mimetype of the content could be represented with the filename. copying to the clipboard would be as simple as copying a file with an appropriate name into the file server directory.

I quickly realized that this was rather overkill. something like this could fly in plan 9 where filesystem apis were the norm, but in unix it felt somewhat forced. instead I decided to make wlsnarf extensible enough to be scripted in such a manner.

wlsnarf is designed to be as hackable as possible, with minimality as a second priority. hackability in this case does not refer to customizing the source code but rather the possibilities that it enables. its interface intends to expose all the functionality of a clipboard manager, nothing more, nothing less. it should have the ability to work as a simple clipboard client like wayclip4, and at the same time have the extensibility to replace a more conventional clipboard manager like wl-clipboard using just simple shellscripting.

-

... gotta work on improving my sentence structure

also snarfsrv is way wackier and much more interesting, i might do another writeup on that


made with <3 and /.gen.sh