LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


What Is the X Window System
Pages: 1, 2, 3

The last line of the file should run the window manager; in fact, that can be the only entry in the file. But it's useful if you want to do work, to set up at least a couple of xterm windows and maybe start a browser or any other application program that you use regularly. Here, for example, is my .xinitrc file:




   #!/bin/bash
   
   xterm -sb -geometry 80x55+5+5 &
   xterm -sb -geometry 80x55+530+30 &
   oclock -geometry +1450+920 -bg ivory -fg blue &
   xscreensaver &

   exec fvwm

This file starts up two xterm windows, with sidebars and the specified geometry. 80x55 is the size of the window (80 characters wide and 55 lines long), and +5+5 indicates where on the screen the upper-left corner should be placed. Every line except the last one ends with an & to put them in the background so the next line can be executed. After starting up a clock with an ivory background (the face) and a blue foreground (the hands), and the xscreensaver program, the script runs the window manager, fvwm.

Now we are ready to establish that we don't want to boot into X. As root, edit the file /etc/inittab and update the line that sets up the initial runlevel. We want it to start in runlevel 3 (multiuser mode) instead of runlevel 5 (X11 mode). Specifically, change the line


	 id:5:initdefault:

to read

	id:3:initdefault:

Then when you restart the system, it will boot to a regular terminal window instead of to X11, displaying a login prompt. After you log in, you can start X:


	 $ startx 

As long as the startup script is running, the X server will also continue running. Since the last command in the script starts the window manager, X will continue to execute until the window manager is terminated, which terminates the script. Thus in effect, stopping execution of the window manager also stops the X server.

In fvwm, to stop the window manager, select Exit Fvwm from the root menu--the menu you get when you click on the root window (the background behind the other windows). Figure 1 shows an example of an fvwm root menu:

Figure 1
Figure 1. An fvwm root menu

Exit Fvwm is the last entry. When you click on it, a submenu asks whether you really want to quit fvwm, whether you want to restart fvwm, or whether you want to start a different window manager.

Figure 2 shows my screen running fvwm, based on the .xinitrc file we just saw, after I'd been working for a while, running commands in the xterm windows and starting some additional X clients.

Figure 1
Figure 2. Using fvwm to run commands and start X clients

The X Server

The X server manages the display hardware. The server captures input events from the user via keyboard or mouse (or other input device) and passes the information to a client application that has requested it. It also receives requests from the application to perform some graphical action. For example, if you use your mouse to move a window on the screen, the X server passes the information to the window manager, which responds by telling the server where to reposition the window, and the X server performs the action. If the client is a calculator, such as xcalc, it might request that digits be displayed into the window as the user clicks on buttons to enter a number.

In any case, it is always the server that interacts with the hardware. Thus only the server software has to be hardware-specific. In fact, only the parts of the server that actually interact with the hardware need to be rewritten for X to be ported to new systems or to be usable with a new terminal or a new type of input device, for example. As long as the X clients are written to use the X Protocol, they can run on any system and communicate with the X server.

Pages: 1, 2, 3

Next Pagearrow




Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: