You are not logged in.

#1 2022-03-08 01:03:49

Inspector Parrot
Registered: 2011-11-29
Posts: 26,692

nkk: simple wayland client library (cairo/pango or opengl on wayland)

I've been frustrated for quite some time that it was really not practical to write wayland clients that do not rely on a major toolkit (qt5/6 or gtk3).  Those toolkits are drastic overkill if all one needs to do is some drawing (e.g., with cairo) or draw some text (e.g., with pango).  But writing a basic wayland client from scratch is a pain.  And after making a couple of them, it was clear that an exceedingly vast amount of the code was shared boilerplate.  I was frustrated that there was no library to take care of the basic setup of a wayland surface and the wayland protocol implementation to receive events, etc.  So I wrote one: nkk.

The name comes from the distance between cairo and wayland (both named after cities roughly 9 thousand km apart).  That's quite a lot of distance to cover, but nkk does it well.  The library was initially called 9kk, but as that is not valid as an identifier in C (for variable/function prefixes) all the in-code prefixes were "nkk" - so I decided that may as well be the library name too.

Nkk is currently still a bit experimental.  There is no guarantee of API stability for any versions with a soname ending with so.0.  But there will not likely be drastic API changes - as the API is quite simple, all the gruesome work is behind the scenes.

The source repo contains a number of tiny examples that show basic usage of nkk for creating and drawing on windows, presenting formatted text, and creating layer-shell windows for backgrounds or docks/task-bars in wayland.  I've also recently added the ability to create egl windows for open-gl drawing.  I have almost no gl experience, so feedback on how to make this more useful to those who would prefer gl drawing would be most welcome.

Feedback is most welcome.  Bugs are expected.  Nkk is available from the aur

Last edited by Trilby (2022-03-29 13:39:24)

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


Board footer

Powered by FluxBB