Getting X configured correctly used to be a real chore. You had to know all the hardware specifications for your monitor and video card, which isn't always easy to gather. Nowadays, though, your distribution's installation program is generally able to autodetect the hardware and find the right settings.
Nonetheless, you still might need to go into the configuration file to tweak a setting or two. Or you might simply be curious about how the file is set up.
You'll find the configuration file in /etc/X11, called xorg.conf for the X.Org server and XF86Config or XF86Config-4 for the XFree86 server. Click here to see what the xorg.conf file for my system looks like.
We don't have space to discuss the details of the file here. What's interesting to note is the way each piece of hardware is defined separately and then in terms of their relationships to each other.
The configuration file is divided into sections. For example, the Module section specifies the modules to be loaded when the X Window System starts up. There can be more than one of a particular section type. In this configuration are two InputDevice sections, one for the keyboard and one for the mouse. Each section has an Identifier, used to reference the section from another section.
At the top of the file, the ServerLayout section ties together
Keyboard0 as the combination of hardware for the
X server to manage. Then if you look at the end of the file, you can
Screen0 comprises the combination of
thus tying everything together neatly.
As we've seen, an X client is an application program that performs certain tasks, communicating with the X server using the X Protocol. The operations performed within a window can vary greatly, depending on the type of program running. Some windows wait for input from the user, functioning as terminals, calculators, or graphics applications. Other windows simply display information, such as the time of day or the system load.
The shaded area that fills the entire screen is called the root window. X client application windows are displayed on top of the root window. X treats windows as a hierarchy, with the root as the origin, or parent, of the application windows displayed on it. Conversely, the application windows are called children of the root window.
But the hierarchy goes further. Not only is the client window itself a child of the root window, but it also can have children of its own; for example, a drop-down menu, which itself is a window.
The window manager is the client application, with responsibility for managing client windows. There are a number of window managers to choose from, many with features that begin to approach those of a desktop. For information on many of the available window managers, see the Window Managers for X web site.
The window manager controls the general operation of the window system; in particular, it controls the geometry and aesthetics of your X display. With the window manager you can change the size and position of windows on the display, reshuffle windows in a window stack, and so on.
Figures 1 and 2 are screenshots from my fvwm-managed system. If you are using another window manager, the X display will have that window manager's appearance. In fact, because X is so customizable, even two users running the same window manager are likely to have screens that look very different.
fvwm is compliant with the Inter-Client Communication Conventions Manual (ICCCM). The ICCCM is a standard that defines interactions between X clients, including client interactions with the window manager. It defines basic policy that is intentionally omitted from X itself, such as the rules for transferring data between applications and for transferring keyboard focus. Window managers and other applications that follow the ICCCM should be able to coexist and work together on the same server, even if they were written using different toolkits. This capability explains why you can, for example, run KDE applications on a GNOME desktop or with fvwm.
X clients are designed to be customized by the user, by setting the value of variables known as properties. Most clients come with a default set of properties; the defaults can be overridden on a systemwide basis or individually by the user. For a user, client properties can be specified on the command line, but more conveniently, they can be set as resources in a file generally called .Xresources in your home directory. Here, for example, is my .Xresources file:
!--------------------------------------- ! XTerm defaults !--------------------------------------- XTerm*saveLines: 500 XTerm*reverseWrap: True XTerm*scrollKey: False XTerm*scrollBar: True XTerm*geometry: 80x50 !--------------------------------------- ! emacs defaults !--------------------------------------- emacs*geometry: 80x66
After setting up the .Xresources file, you can load the resources into the X server using a program called xrdb (the X resource database manager). Typically, you do this in the startup script. Looking again at our .xinitrc script, we can add a call to xrdb:
#!/bin/bash xrdb -load $HOME/.Xresources xterm -sb -geometry 80x55+5+5 & xterm -sb -geometry 80x55+530+30 & oclock -geometry +1450+920 -bg ivory -fg blue & xscreensaver & exec fvwm
Now, the next time you start X, your resource settings will be loaded
into the resource database and made available to the appropriate X
clients. Note that the xrdb command line is not followed by
is because it runs and completes, so the script can proceed to
execute the next command.
Now you can run xrdb again with the
-query option to see what options
are currently set:
$ xrdb -query XTerm*saveLines: 500 XTerm*reverseWrap: True XTerm*scrollKey: False XTerm*scrollBar: True XTerm*geometry: 80x50 emacs*geometry: 80x66
The man page for most X client applications gives the names of the resources you can set for that application.
A separate customization file for fvwm called .fwwm2rc is also kept in your home directory. By editing the .fwwm2rc file, you can modify aspects of the window manager's operation such as the contents of menus, and the keyboard and mouse button sequences used to invoke actions. Other window managers have comparable configuration files. For more information, see the fvwm2 man page. (Note that the current version of fvwm is fvwm2. You can run fvwm2 instead of fvwm in your startup file; fvwm is a symbolic link to fvwm2.)
The X Window System is fascinating and complex. We've only touched on some of its major features. In the last section, I've listed a few resources for finding additional information.
See the links under the heading "Base Technology" on the X.Org web site for explanations of X architecture.
The X man page is not exactly light reading, but it has plenty of good information.
The Linux Documentation Project has a number of how-tos about X, including "The X Window System Architecture Overview HOWTO" and "The X Window User HOWTO."
Return to the Linux DevCenter.
Remote X / XDMCP
2005-08-30 07:04:08 hans-ludwig [View]
2005-08-28 23:56:04 jaiva [View]
XTerm*geometry side effect
2005-08-26 12:13:10 foobee [View]
- Trackback from http://deifl.modprobe.de/blog/archives/47-X-Window-System.html
X Window System
2005-08-26 02:56:10 [View]