|
|
|
What is X The X Window System is a network based graphical windowing system. It was developed by MIT and has been adopted as an industry standard. Most UNIX and Linux machines include X as part of their operating system. If you have "windows" on your screen, chances are, you are using X. X system files are usually located at /usr/X11R6/ (Version 11 Release 6). The X Window System design is based upon the client-server model. A client is an application program that performs a specific task, e.g., xcalc. A server (or more often called display) is a program that acts as the intermediary between client programs and the machine hardware. It keeps track of all user and client input/output. A display server is usually started automatically when you start your computer. In conjunction with the X Window System, there is usually a Window Manager program that allows you to control certain window attributes: look, size, location on screen, etc. Some of the most popular Window Managers for X are, TWM (Tom's Window Manager), FVWM (derived from TWM), UWM (Universal Window Manager), MWM (Motif Window Manager), Kwin (originally called Kwm, default Window Manager for KDE Desktop), and Metacity (default Window Manager for GNOME Desktop since version 2.2). Use X Windows Using the X Window System usually takes three steps: Starting an X server Some systems will start the X server for you automatically and provide you with a graphic login window. Others require you to start the X server manually. This is usually done with the "xinit" command. After logging in, you just type the command and let the server do the rest. You can tailor the manner in which the X server starts by creating a file called .xinitrc in your home directory. If the file doesn't exist, the system will use the default, /etc/X11/xinit/xinitrc. Starting a window manager A window manager is essential for working productively in the X Windows environment. Many systems will start one for you automatically. The easiest way to tell if a window manager is running is to look for a "border" around your X clients. If you need to start the window manager manually, simply type its name and put the process in the background. For example, to start the Motif Window Manager: mwm & You may also be able to add a command as the last line of your .xinitrc file to automatically start the window manager when you start the X server. For example, to start the Motif Window Manager: exec mwm After starting the window manager, your X clients will have borders and can be controlled (move, resize, iconify, etc) via your keyboard and mouse. Starting an X client Usually a terminal emulator (xterm) is automatically started when an X sever is launched. You can specify what clients to start in the .xinitrc in your home directory, or the system default, /etc/X11/xinit/xinitrc. Running X clients on remote machines Because X Windows is a network based system, you can run X clients on machines across the network and send their displays back to the machine that is in front of you. You can also run an X client on any network machine and send its display to any other network machine, provided that the necessary permissions are setup. To run an X client on another machine: Give the other machine permission to send X displays to your local machine with the xhost command: xhost +othermachinename Start the X client on the other machine. This can be done at least three different ways: <1> Use the rsh command and include the -display option. For example, the following command will start an xterm on machine fiber2 and send the display back to machine fiber1. Note that in most cases, the display machine name must be suffixed with ":0": rsh fiber2 xterm -display fiber1:0 & <2> Login to the other machine and start the X client there after you set the DISPLAY environment variable to point to your local machine. telnet fiber2 Using the Window Manager The following discussion pertains to the Motif Window Manager. Other window managers will have similar functionality but behave differently. The Root Menu shows, upon a right click, a pop-up list of the basic window manager functions. Some of these functions include: New Window - open a new xterm Customizing your window manager The default behavior of your window manager is usually defined in a system configuration file. For example, the default configuration file for the MWM might be defined in /usr/lib/X11/system.mwmrc. Most window managers permit you to define your own configuration file. MWM, for example, can be configured by a file called .mwmrc in your home directory. Customizing Your X Clients Default X client resource specifications are usually kept in the directory: /usr/lib/X11/app-defaults. Most X clients permit you to customize various parameters, such as geometry (size), color and fonts. Customizations can be specified as command line options or in an "X Resources" file, called .Xdefaults located in your home directory. Some common command line options are listed below. -background - background color In order to do further customization via an .Xdefaults file, you need to know the actual resource specification. These are unique for each X client. Colors Many X clients allow you to alter their default colors. The colors available to you will depend upon your system, but can usually be found by reviewing the file: /usr/lib/X11/rgb.txt. X colors are specified as RGB values. Each color is a composite of three primaries (Red, Green, Blue). The intensity of each primary is specified as a value from 0 to 255. X client colors can often be set with command line options. In the example below, an xterm is created with a blue background and white foreground (text): xterm -bg blue -fg white & For more detailed (and permanent) color specifications, the .Xdefaults file can be used. For example, the following lines might be used to set xterm colors: xterm*background: DarkSlateBlue Fonts Many X clients permit you to specify alternate fonts for text, and you can look at /usr/lib/X11/fonts/fonts.dir to see what fonts are available on your system. You can also use the xlsfonts utility to list all of your system's available fonts. Full font specifications are very detailed. Wildcards (*) can also be used. For example: 1 2 3 4 5 6 7 8 9 10 11 12 1= foundry The xfd utility is helpful for viewing a font before you actually use it. For example: xfd -fn Rom14 Specifying a font with a command line option: xterm -fn Rom14 & Specifying fonts in the .Xdefaults file: Application Defaults Resources can also be loaded via an application defaults file. This is a file with the same name as the application, typically located in: /usr/lib/X11/app-defaults, or /usr/X11R6/lib/X11/app-defaults For example, the WCEN defaults file is in /usr/lib/X11/app-defaults/wcen. It contains the default values for resources and allows you to customize application components and some program parameters, e.g., default image format, default colormap, and so on: |