Linux › Section N · The Linux desktop and printing › Topic N.1

Desktop components

A Linux desktop is not one program but a cooperating set of parts: a display system, a window manager, toolkits, a desktop environment and the applications on top. Knowing which part does what tells you where to look when a window, a keyboard layout or a whole session misbehaves.

A stack of cooperating parts

Storage and networking in Linux are built as deep layers. The desktop is flatter: each component does one job and talks to the others when it needs to. You can replace almost any piece, from the window manager to the file manager, which is why Linux desktops look so varied. Under every desktop, though, sits one shared foundation that lets programs put pixels on the screen and receive keystrokes. For decades that foundation was the X Window System. Today most major distributions use Wayland instead, with X kept for compatibility. To see why, start with what a screen actually is to the computer.

The framebuffer

At the bottom of every graphical display is the framebuffer: a region of memory that the display hardware scans out to the monitor many times a second. Each pixel is a few bytes, commonly 4 (red, green, blue and one padding or transparency byte). Change the bytes and the picture changes. The hard problem is sharing. Many processes own windows that overlap and move, and each draws independently. Something must decide where each window's pixels land, stop one program from scribbling over another's window, and send keyboard and mouse input to the right program. X and Wayland solve this problem in different ways.

Worked example: sizing a framebuffer

How much memory does one full screen of pixels need? 1. Take a 1920 × 1080 monitor at 4 bytes per pixel. 2. Pixels: 1920 × 1080 = 2,073,600. 3. Bytes: 2,073,600 × 4 = 8,294,400. 4. In binary units that is 8,294,400 / 1,048,576 ≈ 7.9 MiB; in decimal units, about 8.3 MB. 5. A 3840 × 2160 (4K) screen has four times the pixels: 33,177,600 bytes, about 31.6 MiB. Redrawn 60 times a second, a 4K picture means roughly 2 GB of pixel data per second. That figure explains why modern desktops hand compositing to the graphics hardware rather than copying pixels with the CPU.

Two designs: X and Wayland

The X Window System, begun in 1984 and at version X11 since 1987, puts an X server in the middle. The server owns the display and the input devices; client programs such as terminals and browsers connect to it over a protocol and ask it to create and draw windows. The server places windows, renders into the framebuffer and routes input. Wayland, begun in 2008, is decentralised. Each client draws its own window into its own buffer, and a program called a compositor combines all the buffers into the final image, usually with hardware help, and routes input. Wayland itself is only the protocol between compositor and clients.

Window managers

The window manager decides how windows are arranged and drawn around the edges: title bars, borders, and what happens when you drag or tile them. In X it is just another client that advises the server, so you can swap it while the session runs. In Wayland the window manager and the compositor are the same program, effectively the display server itself, so it does far more work. KDE's KWin plays this role on both systems; GNOME's Mutter did too until GNOME 50 (March 2026) dropped X11 entirely. Lighter choices exist too: Sway is a tiling Wayland compositor, and i3 and Openbox are classic X window managers. No single standard window manager exists, and none is likely.

Toolkits and desktop environments

Buttons, menus and text boxes are widgets, and programmers get them from a graphical toolkit, a set of shared libraries plus themes and images. The two main Linux toolkits are GTK (formerly GTK+, now at version 4) and Qt (now at version 6). A desktop environment bundles a toolkit with a window manager, panels, settings tools, notification services, icons and design guidelines, so that separate applications look and behave as one system. GNOME and Xfce are built on GTK; KDE Plasma and LXQt on Qt; Cinnamon and MATE are further GTK-based options. Any application runs under any environment, though it looks most at home in its own.

Applications and how they talk

At the top sit the applications: terminals, browsers, office suites, file managers. They mostly run on their own, but a desktop feels integrated because they also exchange messages. A file manager learns that you plugged in a USB stick; a chat program raises a notification; a media player pauses when a call arrives. That traffic usually travels over D-Bus, the message bus covered in "D-Bus and printing". The display system carries pixels and input, D-Bus carries events and requests, and the desktop environment supplies the shared services that both make use of.

Are you running Wayland or X?

Your session tells you through environment variables. XDG_SESSION_TYPE, set at login by systemd's pam_systemd module, reads wayland or x11 for graphical logins. WAYLAND_DISPLAY names the compositor's socket, typically wayland-0, and is set only under Wayland. DISPLAY, such as :0, means an X server is available. Under Wayland both are usually set, because the compositor also starts Xwayland, an X server that runs older X programs. loginctl show-session with the property Type gives the same answer from logind's records. As of 2026, KDE Plasma defaults to Wayland and GNOME runs only on it; Fedora 43 and Ubuntu 25.10 had already dropped the GNOME on X11 session; desktops such as Xfce and MATE still run mainly on X.

Worked example: reading the clues

Three users run echo "$XDG_SESSION_TYPE $WAYLAND_DISPLAY $DISPLAY" and report the results. 1. User A sees wayland wayland-0 :0. The session is Wayland; :0 is the Xwayland server that GNOME or KDE started for X programs. 2. User B sees x11, an empty middle field, and :0. This is a classic X session, perhaps Xfce: no compositor socket, one X display. 3. User C, logged in over ssh, sees tty and two empty fields. That is a text session with no display at all, so a graphical program started there will fail with a message that it cannot open a display. The habit to build: check these variables before blaming the program.

Common mistakes to avoid

Calling Wayland a display server program: it is a protocol, and the compositor (Mutter, KWin, Sway) is the program. Assuming DISPLAY means an X session: under Wayland it points to Xwayland. Thinking an application must match the desktop: a Qt program runs perfectly under GNOME. Treating the window manager as optional decoration in Wayland: there it is the compositor, and without it nothing appears. Expecting X-only tools to see everything under Wayland: they see only programs running through Xwayland. Giving disk or screen sizes without saying whether MiB or MB is meant.

Key takeaways

The framebuffer is memory holding every pixel; the display system shares it among programs. X uses a central server with clients that ask it to draw; Wayland lets each client draw its own buffer and a compositor combine them. In X the window manager is a helper client; in Wayland it is the compositor. Toolkits (GTK, Qt) supply widgets; desktop environments (GNOME, KDE Plasma, Xfce and others) bundle them into a whole; applications coordinate over D-Bus. XDG_SESSION_TYPE, WAYLAND_DISPLAY and DISPLAY reveal which system you are running.

Flashcards

Flashcard

Framebuffer

Memory holding every pixel the graphics hardware sends to the screen

Often 4 bytes per pixel.

Test your understanding

Question 1 of 5

In a Wayland session, which program combines the windows of all clients into the final screen image?

Question 2 of 5

A user's shell shows XDG_SESSION_TYPE=wayland, WAYLAND_DISPLAY=wayland-0 and DISPLAY=:0. What does DISPLAY=:0 indicate?

Question 3 of 5

About how many bytes does one full frame of a 2560 × 1440 screen need at 4 bytes per pixel?

Question 4 of 5

How does the role of the window manager differ between X and Wayland?

Question 5 of 5

Which pairing of desktop environment and toolkit is correct?

← Previous topicNext topic →