Welcome to the Linux's graphics stack!
required arch linux package: libx11
the source code is available on GitLab.:
screenshot of the program on DWM:
the code is modified version from this great article, see also useful post from unix.stackexchange.com.
other references:
- X basics
- Xlib - more comprehensive tutorial
- mailing list - debate on DWM folks about xcb vs xlib
- not related to Xlib, but I want to put it here anyway: Wayland vs Xorg discussion on suckless subreddit