LinuxDevCenter.com

oreilly.comSafari Books Online.Conferences.

We've expanded our Linux news coverage and improved our search! Search for all things Linux across O'Reilly!

Search
Search Tips

advertisement

Listen Print Discuss Subscribe to Linux Subscribe to Newsletters

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




Tagged Articles

Post to del.icio.us

This article has been tagged:

linux

Articles that share the tag linux:

Managing Disk Space with LVM (74 tags)

Use Your Digital Camera with Linux (60 tags)

mdadm: A New Tool For Linux Software RAID Management (59 tags)

Asterisk: A Bare-Bones VoIP Example (43 tags)

View All

xwindow

Articles that share the tag xwindow:

What Is the X Window System (8 tags)

View All

x11

Articles that share the tag x11:

X11 and OpenOffice on Mac OS X (9 tags)

What Is the X Window System (7 tags)

Test-Driving X11 GUIs (6 tags)

Hands on X11 (5 tags)

View All

introduction

Articles that share the tag introduction:

Demystifying LDAP (11 tags)

A Beginner's Introduction to Perl 5.10 (7 tags)

An Introduction to Ruby (6 tags)

What Is the X Window System (5 tags)

An Introduction to FOAF (2 tags)

View All

unix

Articles that share the tag unix:

Top Ten Mac OS X Tips for Unix Geeks (255 tags)

Automated Backups on Tiger Using rsync (26 tags)

Building a FreeBSD Build System (21 tags)

Keeping Your Life in Subversion (18 tags)

Unix Gems for Mac OS X (14 tags)

View All

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
O'Reilly FYI
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com