DEV Community

Nur Ilyas
Nur Ilyas

Posted on • Edited on

2 1

Basics of Linux GUI stack

DISCLAIMER: This post is written by a complete novice. Information stated may be inaccurate and if so, feel free to correct any mistakes.
RESEARCH TOPIC: Linux GUI stack
WHAT PROMPTED THIS RESEARCH?: I stumbled across a process called 'xorg' and wondered what that is. A quick Google search shows it has something to do with displaying graphics and so begins the journey of trying to understand the Linux GUI stack on a surface level.

Windowing System

  • In a windowing system, there are 2 main components: the display server and the window manager.

    • Display server
      • The display server protocol specifies communication between a client (GUI application) and the display server
      • Relays inputs (keyboards, mouse, touchscreen etc.) to clients
      • Displays the output onto a screen
    • Window manager
      • Works hand-in-hand with a display server
      • Manages the placement and appearance of windows
  • There are 2 main types of windowing system used in GUI Linux operating systems today: X11 and Wayland.

    • X11

      • X.Org server (display server) + Mutter/KWin (window manager)
      • X.Org server is the dominant implementation of the display server for X Window System (X11 Protocol). Basic X11 diagram

      "In the case of X11, A window manager is a regular X client. It doesn’t have any superuser privileges or keys to kernel backdoors; it is a normal user process that is allowed by the X server to call a set of special APIs. X ensures that no more than one window manager is running at any given point by denying a client access to these APIs if another client currently has access. The first client to attempt to access these APIs always succeeds." - How X Window Managers Work, And How To Write One (Part I)

    • Wayland

      I was curious as to how a wayland client would communicate to the display server (wayland compositor). In wayland’s case, it would look for a unix socket (ipc socket) typically named wayland-0. https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Wire-Format

  • Linux GUI toolkits (QT, GTK) now supports both X11 and wayland protocol.

Window Manager

  • "A window manager is a system software that controls the placement and appearance of windows within a windowing system in a graphical user interface." - Window Manager on Wikipedia
  • There are 2 notable types of Window Managers: Stacking and Tiling window managers.
    • Stacking
      • Openbox
      • Mutter/Kwin - more precisely a compositing window manager
    • Tiling
      • i3 (X11 Tiling window manager)
      • Sway (Tiling wayland compositor)

Display Manager

  • A display manager presents the user with a login screen. A session starts when a user successfully enters a valid combination of username and password.
  • Examples are GDM, KDM and LightDM. Ubuntu display manager
  • Ubuntu uses GDM by default.
  • GDM runs on wayland. Display managers that run on X, on the other hand, starts up the X server before displaying the login UI.
  • GDM starts in TTY1 and on user login, it starts up the user session on TTY2. Why is my GDM at a different TTY than my desktop environment? Just a question: Is it possible to start greeter and user screen in the same TTY? Another question: *Session manager https://www.systutorials.com/docs/linux/man/1-gnome-session/ So the method of starting a window manager directly without a display manager does not use a session manager? What does that mean for a user?

Desktop Environments

  • "A desktop environment (DE) usually rides on top of a Window Manager and adds many features, including panels, status bars, drag-and-drop capabilities, and a suite of integrated applications and tools. " - zeal
  • You can run standalone window managers without the need of a desktop environment.
  • See desktop environments vs window managers
  • Examples include GNOME and KDE.

GUI Toolkits

  • Developers use these toolkits to ease development. They do not need to know the intricacies of X11/Wayland to start developing apps for the platform.
  • Examples of GUI toolkits are QT and GTK.

Digression

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay