What Is the X Window Systemby Ellen Siever, coauthor of Linux in a Nutshell, 5th Edition
- X Window System
- The X Window System (commonly referred to as X or X11) is a network-transparent graphical windowing system based on a client/server model. Primarily used on Unix and Unix-like systems such as Linux, versions of X are also available for many other operating systems. Although it was developed in 1984, X is not only still viable but also is in fact the standard environment for Unix windowing systems.
This article discusses the following:
- The X Client/Server Model
- Working with X
- Running the X Window System
- The X Server
- Configuring X
- X Clients
- The Window Manager
- Customizing Clients
- Additional Resources
The X Window System is a graphical windowing system that was developed at MIT in 1984. X was developed as part of Project Athena, a cooperative effort between MIT, IBM, and Digital Equipment Corporation to develop a network of heterogeneous engineering terminals that could be used for teaching purposes. The current version, X11, was released in 1987 and is now up to X11 release 6, known as X11R6.
One reason X has had such staying power is that from the beginning it incorporated many of the windowing capabilities that we now take for granted. These capabilities include network transparency, graphical capability, the use of a mouse, and the ability to link together a heterogeneous network of workstations from different vendors.
In addition, X was intentionally designed to provide the low-level mechanism for managing the graphics display, but not to have any control over what is displayed. This means that X has never been locked into a single way of doing things; instead, it has the flexibility to be used in many different ways. Both the simplest window manager and the most complex desktop environment can, and do, use the X Window System to manage the display.
The responsibility and stewardship of X is currently in the hands of the X.Org Foundation; the X.Org implementation of the X Window System is included with most of the major Linux and free Unix distributions. Until 2004, the standard version of X was XFree86, developed by the XFree86 Project. New licensing restrictions imposed by XFree86 led to the switch to X.org.
The client/server model, as it is implemented by X, may seem backward at first glance. Generally, we think of servers as remote machines like file servers, news servers, or mail servers, with local clients accessing the servers. For X, however, it's the server that runs on the local machine, providing its services to the display based on requests from client programs that may be running locally or remotely. The server also manages the input devices (usually a keyboard and mouse), and it manages the display of colors and fonts on the screen, all based on requests from a client.
One of the most significant features of X is that it was specifically designed to work across a network. The client and the server communicate via the X Protocol, a network protocol that can run locally or across a network. Regardless of whether a client program is local or remote, it communicates with the server through the X Protocol.
Let's talk briefly about working with X, and then we'll take a look at some of the major pieces.
When you run the X Window System, the X server manages the display, based on requests from the window manager. The window manager is an application that is itself an X client, with responsibility for managing the appearance and placement of the windows on the screen.
X itself has no role in determining the appearance of the screen, or what users are allowed to do with windows. That is the job of the window manager. For example, some window managers allow you to double-click in a window's title bar and roll up the window into the title bar like rolling up a window shade (this is referred to as shading). Other window managers don't have that feature. X doesn't care; it's a window manager concern. The X server's job is to provide the low-level support so the window manager and other applications can shade or not, as they choose.
Similarly, the window manager takes care of the appearance and placement of the windows; it doesn't determine what goes on inside. The window might be a terminal window (called an xterm) where the user runs standard Unix commands, or it might be running an X client application like the xcalc calculator, a web browser, or an Emacs session. It's the client application running in the window that determines what happens inside its windows.
Most people today run one of the desktop environments, KDE or GNOME. The desktops go further than a window manager in providing an integrated graphical environment where all applications and windows have a common look and feel. The desktop environments also include session management, for saving and restoring your work sessions. But if you look underneath, you'll still find the X Window System managing the display, and you'll find a window manager sitting between X and the desktop.
X is hidden two levels down from the desktop. For that reason, if you want to explore X further, it's helpful to run with just a window manager for a while, even if you end up going back to the desktop. (It's also interesting to note, by the way, that as long as KDE and/or GNOME are installed on your system, with their libraries, you can run their client programs from a window manager. I've been running the window manager fvwm for this article and using the KDE program ksnapshot to take screenshots.)
You can run the X server in two ways: with the X Display Manager (XDM), or by booting to the command line and starting X manually. There are too many distributions, each with its own configuration and startup procedures, for me to be able to provide general instructions for running the server in this article. But as an example, here's a quick way to set up a Fedora Core Linux system to boot to the command line so you can run the X server manually. This should work for other Red Hat-based distributions, and something similar should work for other distributions.
Your first step, while you are still in the desktop, is to use your favorite text editor to create a startup script in your home directory, if there isn't already such a script. In this case, since we are going to start manually, the file should be named .xinitrc; if we were going to use XDM, it would be .xsession. Be sure to make the file executable.