The X Window System

The last two months, this column provided an overview of Linux and a step-by-step installation process. This month, we're going tell you a little about Linux's windowing interface -- The X Window System.

The last two months, this column provided an overview of Linux and a
step-by-step installation process. This month, we’re going tell you a little about Linux’s windowing
interface — The X Window System.

The Root User

When you start Linux, you first have to identify yourself to the computer by logging on. This
allows each user to have his own individual account or workspace that he may customize to his
liking. This also protects users and their files from each other. Sharing is allowed, but that’s a
whole different subject. There is one special user known as the “superuser”, whose login name is
“root” and whose password is selected when the operating system is first installed. The superuser is
allowed to change any file anywhere on the system. This is important because you need to login as
root to fix things if something goes wrong. You should not login as root during normal use of the
computer, as it’s far too easy to make mistakes that can damage the system. It also opens your
computer up to security problems when you connect to the Internet. However, for the purposes of this
article (since we have not yet discussed how to add more users) we will be logging in as root. (Just
be aware that this is not something you generally want to do).


After logging in as “root”, your command prompt will look like this:

[root @localhost /root]#

Now, this certainly doesn’t look anything like Windows did, but have no fear. What you’re
looking at is a “command line interface”. In this type of interface, you type commands to the
computer one at a time.

What you’re probably used to is an interface with “windows” that lets you use a mouse to “point
and click”. This is called a “windowing interface”. Microsoft Windows is one windowing interface. It is not the only one, however. Linux has one available, and it’s known as “The X Window System” (or
usually just “X”). The free version of X that comes with Linux is known as “XFree86″.

While there’s not much you can do if you don’t like the “look and feel” of Microsoft Windows
(other than change the color of the background and window borders), you can customize X rather
extensively. With X, you can make cosmetic changes like changing the size and style of window
borders, as well as non-cosmetic changes, like changing the option in a menu. One of my pet peeves
about Windows is that in order to type in a given window, you must click in that window and move it
to the front of the screen. It then obscures any other windows on the screen. With X, you can
change that behavior if you don’t like it. In fact, there are so many things you can change with X
that it is easy to be overwhelmed with the number of options. Fortunately, X distributions come with
some default setups, and you should feel comfortable with at least one of them.

I won’t get into detail on how X works; it’s not important right now. But there is one concept
that is useful to understand. When you use X, you are using two main pieces of software — a client
and a server.

Say, for example, that you are using a word processor under X. Some software has to be
responsible for the actual drawing of a box on the screen where the text is going to appear and also
the drawing of the text itself. Some other software is going to be concerned with what words you’ve
typed and what font you expect to see (the actual word processing functions). It’s natural that
these two functions be separate, and in fact they are. The “X server” software is concerned with
your display screen — drawing boxes and shapes, watching where the mouse is pointing, and what
buttons if any are pressed. The XFree86 program itself is the “X server”. The word processor is an
“X client;” it only cares about reading what you type and figuring out what the output should look
like. It’s called a client because it makes requests of the server, as in “server please display
this text in my window”.

Window Managers (Part One)

So we know that the X server watches the mouse’s movement and draws a pointer as you drag it
across the screen. But how does the server know that you want blue borders around the windows and
that the screen background color should be turquoise? How does it know which window you want to be
on top? Well, that’s decided by another piece of client software called the “window manager”. This
software determines how X will “look and feel”. X allows you to change window managers at any time
and thus completely change the look and feel of your system. Additionally, almost all window
managers let you customize their individual look.

This all may sound rather complicated, and it’s certainly not something you had to deal with in
Windows. But try a few window managers on your Linux computer and you’ll appreciate being able to
choose the style of interface that you want.

There are lots of popular window managers available, and you can download most of them from the
Internet. Red Hat Linux comes with more than four. It’s very easy to change from one to another and
decide which one you like.

Now that we’ve discussed a little about how X works, let’s start it up.

Starting X

Starting X is simple. For now we’ll do it from the command line. Later, you can set things up so
X starts automatically. To start X, just type


at the command line
and press the enter key. The screen will go blank at first, and X may take several seconds to start
up. While you wait, keep reading; there are three commands I want to tell you about right away.
These are “ctl-alt-+”, “ctl-alt-” and “ctl-alt-back”.

For our purposes, “ctl-alt-+” refers to pressing simultaneously the “ctrl” key, the “alt” key,
and the “+” key on the numeric keypad. Similarly, “ctl-alt-” refers to the “ctrl” key, the
“alt” key, and the “-” key on the numeric keypad; and “ctl-alt-back” refers to the “ctrl” key,
the “alt” key, and the “backspace” key.

The first two commands are used to switch display resolutions. Let me explain what I mean by
that: In Microsoft Windows, when you click on “Display” in the control panel and then click on the
“Settings” tab in the “Display” window, you get something like Figure 1.

Newbies NT Display 1

In the part labeled “Desktop Area”. you can set different screen sizes or “resolutions”. Of
course changing this setting does not change the size of your physical screen, instead it changes the
size of what’s displayed on it. I like to pack a lot of information onto my screen, and I don’t mind
if the features are small, so I set mine to “1280 by 1024.” If I want bigger icons and larger text,
I can always change this later.

You can do the same thing under X. During your Linux installation, you told the system what kind
of graphics card and monitor you have. X probed those to decide what resolutions your computer could
probably handle. If it decided that your computer could handle more than one, then you can change
from one to another by pressing “ctl-alt-+” or “ctl-alt–”. If X thinks your system can handle only
one resolution, then these commands will do nothing.

The command “ctl-alt-back” is used to get out of X and return to the command line. If you’ve
waited patiently for X to start, but your screen is still blank and you suspect that something is
wrong, then press “ctl-alt-back” and you should come back to the command line prompt. X may not be
configured correctly on your system and we should diagnose that.

Debugging X

Most likely, X started just fine for you. If you have a graphics card and monitor that were in
the menus during installation and you selected them correctly, then there should be no problem. If
not, then it’s difficult to tell what’s wrong and you may have to call technical support for
whichever distribution you are using. Or you can read the FAQs listed at the end of this article.
If you don’t find an answer there, you can also try posting a question to the appropriate Usenet
newsgroup. Diagnosing X in detail is certainly more than I can cover in this short column.

There are two commands that you can try, however, if X is not working. While logged in as
“root”, type
Xconfigurator at the command lineprompt. This will lead you through a
procedure much like the one you went through at installation, and you can try again to select your
proper card and monitor.

Another useful command is XF86Setup. This one is much more powerful and
gives you much better control over what you are changing. If you select the “Card” button at the top
of the screen, then a “Card List” button will appear in the bottom third of the screen.

If your card is not listed, don’t despair; there still might be a version of the XFree86 server
available that will work for your system. When I first installed X, my graphics card was not listed,
but another one with a similar name from the same manufacturer was. I selected it during the
installation, but it didn’t work and I found that my card was not supported. There was a new XFree86
available on Red Hat’s site that did support my card, and I downloaded it. It works fine.

By the way, if you have trouble with your mouse, you can use “mouseconfig” to change your mouse

The First Desktop

Now you know how to start X, how to stop it in a hurry, and how to change screen

Newbies Rootwin 2

If you’re using Red Hat Linux, your display should look something like Figure 2. There is a
terminal window in the center of the screen and the “Red Hat Control Panel” along the side. On the
bottom-right there’s a box with a grid and a graph. The graph shows the system “load average”, which
is just a measure of how busy the computer is. The grid shows you which “virtual desktop” you are
using. With X you can have multiple desktops available to you, with some of them hidden off screen.
To select a different desktop, just click on its grid box.

Pressing each mouse button while the mouse pointer is over the background area will bring up
distinct “floating” menus. Note that X originated on systems that used a mouse with three buttons,
not a two-button mouse like the ones most PCs come with. The third button is not required, but can
be quite useful. So, if your mouse has only two buttons, pressing both buttons together tells X that
you mean the third mouse button (the one you don’t have.)

If you click on the right button, a menu labeled “Programs” will come up, which has lots of
useful applications and utilities in it. Clicking the middle button (or both buttons together) shows
you all the windows that you currently have opened. If any are “iconized”, you can reopen them
through this menu. (X allows you to “iconize” windows. This means that you can close a window
without quitting the program that’s running in that window. Clicking on the icon will also re-open
that window.)

At the bottom of the screen there’s a toolbar much like the one in Windows, with a “Start”
button on the left. If you click on that button you’ll see the same menu that you would get if you
position the mouse over the “desktop” (which is really called the “root window”) and click the left
mouse button (see Figure 3).

Newbies Rootmen 3

You’ll find that as long as you keep the mouse pointer within the
floating menu, you don’t have to keep the button pressed. If you want to peruse
your files, you can click the right mouse button (Programs) and move to “Utilities”. Move to “File
Management” in the menu that “Utilities” brought up and select “xfm”. This will start the “X File
Manager”, which behaves a bit like Windows Explorer.

Window Managers (Part Two)

I mentioned earlier that you could change your window manager. To do this, click the left mouse
button to bring up the “Start” menu. Selecting “Exit Fvwm” will bring up more options. Now select
the “Switch To…” option and you should have a choice of four window managers. Each of these will
look and behave a little differently. They will each have the “Switch To…” option so that you can
try them all. Notice that when you change window managers, your windows remain the same; they just
look different and have different menus. That’s because the windows are maintained by the X server
and the clients have requested that they be displayed. Changing the window manager does not affect
that. The window manager only worries about the look and feel of the actual windows.

As you already know, “ctl-alt-back” is the quick way of exiting windows. The “polite” way,
however, is to choose the “Exit Fvwm” option from the left mouse button (Start) menu and select the
option “Yes, Really Quit”.

Until Next Time…

You have now installed Linux and have X running. Find out which window manager you like and
explore the utilities available. If you get yourself into trouble just get out of X (the quick way
if you have to) and restart it. No need to restart the computer.

If you have Internet access and have trouble (or are just curious), you can check out
http://www.xfree.org/ FAQ for help with X and http://www. linux.org/help/faq.html (or http://www.linux.org/help/index.html) for general Linux questions. That should keep you entertained for a
while. Or at least until next month.

Hal Moroff has been developing UNIX systems and applications for 20+ years. He’s new enough to
Linux that he’s finding new things every day. He can be reached at

Comments are closed.