Working principles of the X Window System

Learn how your desktop environment works

The X Window System, was born in the 1980's at MIT as a graphics framework for UNIX applications. X works as a client-server model. The clients will communicate with the server by sending information of user input and the server responds with updates to the screen. This made a lot of sense in that time, since a single machine would have many users using it at once. Remember that in that time, people did not have their own personal computers. Instead, an organization would buy a very expensive but capable computer to which several people would logon and use simultaneously. Every terminal would have a very small computer to handle the connection with the X server and little more. The graphics card was not in the terminal but in the server, so it was a necessity that graphics be handled at the server rather than at the terminal.

The X Window System persists to this day in most UNIX-like operating systems, which is a shame because now you will hardly find the need for such a complicated system, since the graphics card is on your machine and not in the network. Apart from that, the whole system has become a bit of a mess over the years, with outdated interfaces and piles of legacy code. You will however probably use it so it is good to have at least some understanding of it.

NOTE: Wayland is being developed now as a replacement to this antique system

The server clients

The server only knows how to draw shapes with colors. It does not know what colors to put or how to handle the position, scaling and visibility of the client windows. Thus it needs a special client called the Window Manager. This is the client that handles the desktop mechanics. It should not be mistaken with the 'Desktop Environment'. The difference is that while the Window Manager only handles what gets show on the screen, the Desktop Environment is the window manager plus all the utilities that come with the desktop -- settings, application launcher, etc --.

User applications on the other hand will communicate with the server and create -- except for a few specific cases -- a window that will be shown in the screen. To the client, its window is all that it cares about and operates it via commands to the X server. The Window Manager will then take care of position, scaling, movement and depth of the window.

This framework permits the user to switch window managers -- which can have different styles, keybindings and mechanics -- without modifying the other applications.

  X SERVER <---------> terminal emulator
      ^  ^-----------> web browser
      |                ...
      |
      |
      v
     W M
NOTE: You can find plenty of window managers on-line

Launching the X server

Assume that we are at a TTY and want to launch your window manager. First, we will have to create an init script:

file:	~/.xinitrc
format:	shellscript

... pre-launch config -- e.g. environment variables, etc

setxkbmap -layout es	# this will enable the spanish keyboard (defaults to us)

exec dwm

At exec -- check shell man page -- the script will be replaced by the instantiated process, but will keep the environment variables and X configuration from the script.

Once created, the only thing that remains is to call the 'startx' command and the server will launch with our window manager, as simple as that.

X Utilities

Here is a brief list of useful utilities -- most installed by default --

Sources

[1] Robert W. Scheifler, Jim Gettys: The X Window System. MIT, 1986

[2] X.Org Foundation [on-line]. Availiable at https://www.x.org/wiki/

[3] Arch wiki [on-line]. Availiable at https://wiki.archlinux.org

Izan, 06 Feb 2026, LLU blog