KC7MM Wiki

Amateur Radio with KC7MM

User Tools

Site Tools


linuxusernet:inside_linux:graphical_ui

A Look Inside Linux series

A series of short topics on how Linux works and how to make it work the way you want it to, which I present during the weekly sessions of the Linux User Net. The target audience is Hams who are new to Linux and want to know more about it, as well as experienced Linux users who can learn more about their chosen operating system. These are my notes for the presentations. (Russ, KC7MM)

11. Linux system layer 4: Graphical User Interface

Introduction

Having covered the Linux kernel, the application layer and the graphics layer, we find ourselves at the top layer of the “cake”. This is the graphical user interface, commonly referred to by its acronym: GUI, or “gooey”.

The most common model of a GUI follows the interface developed by Xerox at its Palo Alto Research Center, and popularized by Apple with the McIntosh. It's based on using keyboard and mouse to manipulate windows.

Not surprisingly, this GUI model is the one most used on Linux systems (there are others that we'll ignore for now).

Layers within layers

We saw last week that a Linux system can (optionally) have a graphics layer, or subsystem, installed. Developers have constructed a window-based GUI layer by stacking three sublayers on top of it:

  1. A graphical desktop

Let's take a look at each of them, in turn.

Window manager

Everything is a window

We saw last time that the graphics subsystem (X11 or Wayland) provides “window primitives” that can be used to create graphical user interfaces. So, what is a window, and how does it work?

  1. Let's start by looking at a video screen. It's a rectangular matrix of luminescent dots, or pixels, which can be selectively turned on or off. When on, they can be set to various colors, when off, they are black.
  2. A window is a subsection of the screen. It is a rectangular area that can act as a virtual screen, available for use by a program.
  3. Video input and output can be directed to windows as though they were physical screens.
  4. The result is that programs can “run in a window” – that is, they can be confined to certain areas of the screen.
  5. Multiple windows can be on the screen at the same time.

We saw last time that the graphics subsystem (X11 or Wayland) provides graphics primitives. These are basic geometric elements – points, lines, arcs – that can be composed into screen images. They are the building blocks for screen graphics. These can be drawn inside windows to create the shapes, images, and text that we see on the screen.

Making windows

The job of a window manager is to use the primitives provided by X to build the graphical screen elements that comprise a user interface: movable windows, menus, toolbars, buttons, text boxes, etc.

It also endows them with the actions that enable us to use the interface: clicking, scrolling, dragging, typing, and many more.

The result is a set of graphical components that can be assembled into a user interface: a virtual desktop.

As users of graphical interfaces, our experience with “windows” is that they are framed-in areas that contain running applications. At the window manager level, however, every screen element is a window.

As an example, think of a button somewhere in your screen. It has:

  1. A rectangular screen area that is given a unique identity that can be addressed within a program.
  2. Images written within the window area that make it look like a physical button, and also reflect its action when pressed (e.g., “Cancel”) and its current state: pushed, toggled, etc.
  3. The ability to selectively receive user input by mouse or keyboard. This happens when the window has focus. (Tabbing between elements moves the focus.)
  4. The ability to respond to user input by generating program events that make things happen in the running application.
  5. The ability to respond to program events that occur elsewhere in the UI – or in the program itself.

The result is something that looks like a button and acts like a button, but is, in fact, a window. All GUI elements work in a similar fashion.

Graphical desktop

Once a window manager is in place, it can be used to create a graphical user interface. This generally follows the model of a desktop presented on the screen.

The desktop is built on top of a window manager; that is, it employs the capabilities of the WM to display and control the desktop's elements. It runs in a shell as an application, with root permissions.

The desktop makes available to the user the basic features of a GUI:

  • Windows in which applications are executed.
  • Menus for navigation and for selecting options.
  • Toolbars with buttons and displays.
  • A mouse pointer for selecting and manipulating video elements.
  • Styles for graphical elements, e.g.,
    • Window headers and borders
    • Fonts
    • Colors
    • Shape and size

It also includes a virtual terminal for use in system administration and running programs.

Desktop environment

While a desktop provides a minimal interface for the user to operate the computer, it gives little more that that. Users today, though, have grown accustomed to more elaborate interfaces, ones that make it easier to to use the computer and its installed applications.

For that, we have the desktop environment. This starts with a virtual desktop, to which is added a bunch of graphical utilities for user convenience. Among them are:

  • File manager
  • System administration tools: e.g., UI configuration, softwaree manager, users and groups, printers.
  • I/O management: Network, Bluetooth, USB, disk drives.
  • Audio and video controls.

Popular desktop environments include KDE, Gnome, Cinnamon, MATE, XFCE, and LXDE/LXQT. There are many others. In fact, the creation of a new desktop environments is one of the prime motivations for making a new Linux distribution.

I won't go into detail on the various environments now; that's a topic for another day.

Summary

Today we looked at how a modern graphical user interface is built on top of the Linux graphics subsystem:

  • A window manager to provide the basic screen elements.
  • A graphical desktop that uses those elements to provide a basic user interface.
  • A desktop environment that provides convenient tools to make it easier to use and administer the system.

Keep in mind that this hierarchy describes the GUI from the perspective of a programmer, for the purpose of understanding how graphics systems work on Linux.

In reality, these three terms tend to be used interchangeably – which can be a bit confusing. For example, you'll find XFCE in lists of window managers, desktops, and desktop environments. You just need to know that they all refer to the same thing.

This wraps up our look at the “layers” that make up a Linux computer system. I hope you found it useful.

Return to series index

linuxusernet/inside_linux/graphical_ui.txt · Last modified: 2022/03/23 21:20 by KC7MM