In this section we will become familiar with running clients in X Window and the basic procedures involved in using the system. X is not an intuitive interface on its own, and without any window manager, it is easiest to use as a display for programs started from the command line. One of the most common uses for X is just to have several xterm windows open at the same time. Not exactly maxing out the graphics capabilities of the computer, but it's a nice feature to start with.
The flexibility and usefulness of the command line is so great, in fact, that you don't really need a window manager. It's nice, and you will want it very quickly, but the fact is that you can get by without one, just the command line and the mouse. If you give it a shot, you'll be surprised as to the exact distinctions between the clients and the window manager. If you start toying around with this, however, remember that the key combination Ctrl-Alt-Backspace gets you out of X Window in a pinch.
Most X programs try to use the same basic names for command line options. All applications written using the MIT X Toolkit Intrinsics automatically accept the following options:
This option specifies the X server to use. See the section on Display Names for details.
The initial size and location of the window, in a format such as widthxheight+hoffset+voffset or +hoffset-voffset. Note that if you put in a negative horizontal or vertical offset, the window will be placed counting backward from the right or the bottom of the screen, respectively.
The font to use for displaying the text in your window.
The color to use for the window background.
The color to use for the window foreground.
Useful for specifying the name under which the resources for this application will be found. This is useful to distinguish between invocations of the same application, for example, two xterms can be named differently so that they may inherit different resources based upon those names in the resource database.
This is the title to be used for the window on your display, generally used by the window manager to put a descriptive title at the top of the window. Not to be confused with the -name option.
Invoke window as an icon.
This option specifies a
resource name and value to override any defaults that may already be
set. Also useful for setting X resources that do not have explicit
command line options. For instance, the command line xterm -xrm
"xterm*background: blue"
is functionally identical to typing
xterm -bg blue
.
Every X Server has a display name of the form:
hostname:displaynumber.screennumber
The hostname specifies the name of the machine to which the display is actually, physically connected. The hostname can be omitted, and if so, the server on the same machine will be chosen. In fact, if you are the only one using X on your computer, you will want to just leave this off of your display specifications. The displaynumber should probably be zero, this is used if the X Server is controlling more than one keyboard and monitor unit, for instance, a network of X terminals. The screennumber specifies which monitor in a multiple monitor setup should be used. Following this specification, you would open an xterm window on your local machine with the option -display :0.0. You can see that we have omitted the hostname from the option, so the current machine is assumed.
On Linux systems, your DISPLAY variable holds your display name, which on my system is :0.0. This is usually set by xterm, or one of the scripts that starts X Window for you, although you can set it yourself, or as discussed above, use the -display command line option when invoking your application.
If you have opened an xterm or rxvt window, and then
opted to do super-user work via the su
command, you will find
that if you try to launch an X application you will have no display to
launch it on. Silly it seems, because you are sitting right in front of
your display, but the trick to getting this to work is to pass an
option
on the command line to the program such as -display :0.0
, and
it
will work fine.