Opening windows in Linux with sockets, bare hands and 200 lines of C

X Server is slowly being deprecated in the Linux world and being replaced Wayland. Still X11 is an interesting protocol to look at from the perspective of binary communication and management of resource which require fast speeds.

In this post I tried to cover basic information and create a simple but working app that is simple, defined in single file and easily compiles. No external code except libc was used. I find it fascinating when you can open black boxes and see how gears move each other.

Hereket

As much as the time of X has come and is now finally in the process of going, it’s still an incredibly powerful set of tools that even in a bare state can do way, way more than you think. X has come with its own window manager – twm – for decades, and it includes several basic applications like xedit, xclock, xterm, xeyes. Twm is actually pretty cool, and includes some features, like iconify to desktop, that I wish still existed in modern desktop environments. It’s quite bare-bones, though, and I doubt there’s anyone out there unironically using it today.

As the linked article notes, even without advanced, complex libraries, toolkits, desktop environments, and so on, it’s entirely possible to create fully functional windows and applications with X. Of course, this makes perfect sense and shouldn’t be surprising – it’s the X Window System, after all – but you so rarely hear or read about it that you’d almost forget and just assume something like GNOME or KDE is an absolute requirement to use X.

One Response

  1. 2024-05-09 9:41 pm