Widgets Inc., or Inside Graphical Environments

There are many personal computer operating systems which offer graphical user interfaces. While the details differ, most of these systems try to give a unified, monolithic approach which handles all of the interaction tasks in one all-reaching way. A user of Microsoft Windows cannot separate its kernel from its graphical features, and a user of most versions of Apple's MacOS likewise would boot directly into a graphical system that is deeply ingrained in the operating system.

One of the most promising, and yet confusing, aspects of Unix-style architectures is that everything is broken up into small replaceable pieces, each part of which has a very simple task. The graphical interface is no exception. There is a veritable factory of little processes and services which makes up the average Linux desktop environment.

X, X11, XFree86

Linux ultimately bases its graphical environments on the X Window System, otherwise simply called X. This standard describes a protocol for applications which need to share a graphical space like a computer screen.

This protocol has been revised over the years, and the current versions are (roughly) release 6 of version 11 of X, thus the monikers X11 and X11R6 that you may encounter in your Linux setup. X

Unlike some other computer systems which assume that the display is attached to a high-powered processor, the graphics processing can be done on one end of a network, and the actual display can be done on a properly configured X terminal, across a network connection or tunnel. With X, there's a central server process and any number of client processes can connect and request various rendering tasks. Distributions of Linux tend to include the XFree86 implementation of the X server component. Though it's named after its origins on Intel i386 style hardware, XFree86 now runs on several hardware platforms supported by Linux.

With this server/client split, X becomes a very flexible set of options, and a perhaps confusing array of choices with which the Linux user must try to come to grips.

Some helpful google searches may be linux x x11 xfree86, x11r6 protocol server, and x11 tunnel over network.

Window Managers and Widget Toolkits

Many users don't even notice the XFree86 server running, but without it, graphical applications wouldn't be able to display any of their easy-to-use interfaces. Once the XFree86 server is running, the user can run client applications that communicate with XFree86.

Clients ask XFree86 to create windows, listen to mouse and keyboard controls, and animate various graphics within those windows. This is analagous to the shell environment: show a prompt, listen to the user's input, then show the results.

However, the X protocol is a lot more complex than the text-only protocols used by shell environments. Graphical User Interfaces, or GUIs, offer an endless array of buttons, icon layouts, text fields, scrollbars, check boxes, popup menus, tab selectors, and image viewers. Compounding this, each of these features may be displayed in different visual styles, from wood-grained to futuristic, from creamy glass translucencies to deep shades of black.

If every application had to implement all of these controls themselves, apps would work extremely inconsistently, raise the software's complexity, slow the computer down, and fatten the memory requirements. To sort chaos from order, these features are often divided up into two general components that can be shared by all applications on the system: the Window Manager, and the Widget Toolkit.

The Window Manager is a process which runs as an X client. It monitors any new windows created by applications, and adds new bordering graphics around them. If the user interacts with the border graphics, the Window Manager moves, resizes, closes or hides the application's window. The application does not need to understand any of these interactions. There are several Window Manager types of applications, only one of which can be run at any given time. Some leading names are sawfish, fvwm2, twm, enlightenment, and WindowMaker. Each offers different window management features, different visual styling, and different memory or processing overhead.

A Widget Toolkit is not a process, but a collection of shared library components which help applications fill their windows with useful buttons, text fields, scrollbars and other GUI basics. A given application is designed to depend on a certain toolkit library directly. The application can then use any of the features offered by the library, arranging them however the application needs. The toolkits simplify the X protocol issues, which in turn simplifies the application design. Since it is the applications themselves which depend on the toolkit libraries, it's okay to install multiple toolkits to support a wide variety of applications. Most distributions will install at least Qt and GTK toolkits, allowing any applications depending on either of them to run on the same X desktop.

Some helpful google searches may be linux window managers, linux gtk qt toolkits, and enlightenment twm sawfish.

Client Environments

The various widget toolkits aim to distill the abstract widget design from the specific X protocol issues. Application designers can focus a little more on the application design and not the protocol that makes it happen.

Likewise, client environments try to unify the user experience and make it more consistent and functional. If every application used an entirely different toolkit, the interface would still be chaotic.

There are two major client environments offered for Linux: KDE and GNOME. These add more libraries for application development.

In addition to the actual technologies involved, the client environment projects add another major benefit to Linux: they are essentially "steering committees" who drive the direction of Linux user interface design and development. KDE and GNOME groups offer informal and formal guidelines to application developers, so that programs are more consistent and share more capabilities with each other. Not every program must comply, but the benefits of easy and consistent user interfaces are strong incentives to the success of the application, and it could be said, of Linux in general.

Some helpful google searches may be linux kde, linux gnome, and comparing kde and gnome.

Choosing between STARTX and XDM

The following distinction applies mostly to the distributions which comply with the LSB (Linux Standard Base) conventions. If you're using Debian, for example, some of these details may not be accurate for your setup.

If your Linux system is in runlevel 3, that is, in the non-graphical mode, then each of the virtual terminals (or gettys) are offering text login screens which enter directly into bash or similar shell sessions. In any such text-screen virtual terminal, the startx command will launch a fully self-contained X session, including the XFree86 server and its components, and a client environment usually specified in a system configuration file, such as in /etc/X11/xinit/Xclients. The Ctrl+Alt+Backspace key combination signals the XFree86 and startx processes to shut down; the xterm command does the same thing. This leaves the user directly back into the original shell session.

Conversely, if your Linux system is in run level 5, the graphical mode, then the system will start a graphical environment automatically. This is done through a "desktop manager" program, which may be xdm (the original plain version), or the alternatives kdm from KDE or gdm from GNOME. All of these function essentially the same: they start XFree86, they prompt for a login, they start a login session in the desired client environment, and they recycle everything necessary when the user requests to log out. A new login window appears after the XFree86 server is reset. The user never has to touch one of those plain text-only virtual terminals if they don't want.

There are configuration files, both system-wide and in any user's home directories, that can adjust which client environment is desired whenever startx or xdm begin.

Some helpful manual pages on your Linux system may be (man inittab), (man startx), (man xterm), (man xdm), (man kdm), and (man gdm).

Some helpful google searches may be linux graphical login, linux startx xinitrc, lsb linux standard base, and linux xdm desktop manager.



Contact Ed Halley by email at ed@halley.cc.
Text, code, layout and artwork are Copyright © 1996-2005 Ed Halley.
Copying in whole or in part, with author attribution, is expressly allowed.
Any references to trademarks are illustrative and are controlled by their respective owners.
Make donations with PayPal - it's fast, free and secure!