Some Layers of the Linux Desktop

3 min read Original article ↗

This is a helpful (to me) listing of some layers of components in the Linux Desktop stack.

We'll go approximately from the foundation up through the things that build on it.

Kernel

The Linux kernel is the core code that enables it and other software to run on the hardware. It is the low-level interface with hardware.

Operating System

This encompasses the kernel and some essential user-space programs. This includes init programs like systemd, the c libs, core utils and login.

TTY

Stands for teletype. Part of the Kernel. Processes I/O from the terminal to the kernel.

Terminal

The device providing keyboard input and text display output. TTY used to be a part of it, because it was a physical keyboard and screen connected to a mainframe. These days, it's all software and separate, and it's a virtual terminal.

The "console" is the primary terminal.

Shell

This is the program that runs inside the terminal and interprets the commands. It manages jobs, such as foreground and background processes. It provides scripting capabilities.

Here, there is still just text only. No graphics. From the shell, you can start a display server, such as xorg, using startx.

Examples include bash and zsh.

Display Server

This enables graphical interfaces. There are two main flavors of display server in Linux: X11 and Wayland.

X, x11 and xorg are often used interchangeably, usually meaning "display server". Each is a more-specific thing as well:

"x11" is a protocol for how client programs talk to display server (a spec like http).

"xorg" is an implementation of x11. It is the most common x server on linux.

"x", as in "x server" or "x windows", is an ambiguous term for "display server" (like "the webserver").

Display Manager

Aka dm. This is a graphical login screen. You might boot to this instead of straight to tty. This handles authentication, then will usually start a display server automatically.

Window Manager

Aka wm. This controls the drawing of windows -- where they're placed, their size, focus, interaction between them, decoration, etc.

Examples of Window Managers separately distributed are dwm, i3wm.

Compositor

Used in conjunction with the Window Manager, it draws the final version of windows on a screen.

It's optional in x11. When used, it allows interesting graphical elements on windows, like shadow, animation, scaling and transparency. It can also help avoid screen tearing.

Compositing usually happens in offscreen buffers, where images are combined into the final render.

An example of a compositor is picom. In wayland, the compositor is built into the window manager, such as with hyprland.

Client Programs

There are too many of these to count. But how do they fit into the stack? These are apps like gimp or alacritty. They don't speak x11. They use a UI toolkit like gtk that abstracts away the display server.

If the app is on an x11 server, it speaks x11. If on wayland, speaks wayland.

The client programs could connect to x11 directly without a window manager, but then they'd be overlapping, immovable and unmanaged.

Terminal Emulator

This is a special client program. It puts the shell in a graphical window. This allows typing into the repl from a windowed environment.

An example of this is alacritty.

Desktop Environment

This is the all-in-one package. It works with the display manager and often include everything layered after it. It'll determine your display server, window manager, compositor. It'll package many client programs. It includes other environment features, such as task bars, control panels and launchers.

Examples of this are cosmic, gnome and kde.

Linux Distributions

Flavors of Linux, where a company, group or individual packages up some combination of these components is a distribution.

Examples of these are Ubuntu, Arch or Gentoo.

Are there other layers? Other details? Yes. Which do you think are important, but omitted here? What is conceptually off?

Viva la Linux!