134.

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); }

Book: LPI Linux Certification in a Nutshell
Section: Chapter 18.  X (Topic 2.10)



18.5 Objective 4: Install and Customize a Window Manager Environment

The selection of a desktop environment for X is a personal decision. At a minimum, you need a window manager such as twm to provide basic window frames, menus, and controls. On the more elaborate side, an integrated working environment such as KDE or GNOME offers a rich set of applications. Regardless of how you configure your desktop, it's important to understand some basic customization techniques.

18.5.1 Starting X and a Default Window Manager

Starting XFree86 can be as simple as issuing the X command as root. However, X alone doesn't give you a working environment. At the very least, you also need to start a window manager and an application and set up basic X access authority.[8] You may also wish to choose from among multiple desktop environments and window managers installed on your system.

[8] X authority configuration is beyond the scope of the LPIC Level 1 certification and is not covered in this book.

18.5.1.1 The XFree86 startup process

Assuming for the moment that we're not using xdm, the process of starting X goes like this:

  1. The user issues the startx command. This is a script provided by XFree86 and often modified by distributors and administrators. startx is intended as a frontend to xinit.

  2. startx calls xinit with two main arguments:

    1. An Xinitrc script, which contains X programs to run. This script could be .xinitrc from the user's home directory, or if that doesn't exist, a systemwide default found in /etc/X11/xinit/xinitrc.

    2. Server options, such as X authority information.

  3. xinit launches XFree86 and the chosen Xinitrc script.

  4. XFree86 starts. Note that X itself does not provide any applications. They appear only as the result of the commands found in the Xinitrc script.

  5. Client programs and a window manager found in the Xinitrc script start.

The contents of startx and the system default /etc/X11/xinit/xinitrc can vary from distribution to distribution and can be changed by administrators to suit local needs. They may also reference additional files, such as /etc/X11/xinit/Xclients, to determine which programs and window manager to run. Example 18-4 shows the contents of /etc/X11/xinit/xinitrc, a modified version of the original distributed with XFree86.

Example 18-4. A System Default xinitrc
#!/bin/sh # $XConsortium: xinitrc.cpp,v 1.4 91/08/22 rws Exp $ userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap sysresources=/usr/X11R6/lib/X11/xinit/.Xresources sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap # merge in defaults and keymaps if [ -f $sysresources ]; then     xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then     xmodmap $sysmodmap fi if [ -f $userresources ]; then     xrdb -merge $userresources fi if [ -f $usermodmap ]; then     xmodmap $usermodmap fi # start some nice programs (sleep 1; xclock -geometry 50x50-1+1) & (sleep 1; xterm -geometry 80x50+494+51) & (sleep 1; xterm -geometry 80x20+494-0) & exec twm 

In this example, resource and keyboard mappings are set, a few applications are launched, and the twm window manager is started. twm is installed as a basic default window manager on most distributions.

18.5.1.2 Customizing twm

Each of the window managers and desktop environments has its own style of configuration. In the case of twm, a single file called .twmrc in the user's home directory is used. If .twmrc doesn't exist, the system-wide default /etc/X11/twm/system.twmrc is used. The file can include:

  • Font selections

  • Color selections

  • Bindings between actions (such as mouse clicks) and twm responses

  • Menu definitions

Even for a basic window manager such as twm, a wide array of configuration options is available to tailor the window manager to your personal taste. Example 18-5 contains parts of system.twmrc, which defines a default options menu, defops, and a submenu that starts various X terminals.

Example 18-5. Menu Configuration in system.twmrc
menu "defops" { "Twm"           f.title "Netscape"      f.exec "netscape &" "Terminals"     f.menu "Terms" } menu "Terms" { "Aterm"         f.exec "exec aterm &" "Kvt"           f.exec "exec kvt &" "Xterm"         f.exec "exec xterm &"}

For complete information on twm, see its manpage (man twm).

On the Exam

This Objective requires that you have a general understanding of the configuration of menus for a window manager. You will not be required to generate window manager configuration files for the test, but you should be aware of the need to edit and modify them.

18.5.2 xterm et al.

One of the most important applications available to a system administrator working in a graphical environment is a terminal emulator. The standard terminal emulator distributed with X is xterm, which understands DEC VT and Tektronix graphics terminal protocols. The VT behavior that is emulated includes cursor positioning, character effects, and reverse video, among others. In essence, an xterm is a direct replacement for a hardware terminal.

xterm has a large resource configuration file located in /usr/lib/X11/app-defaults/XTerm that contains configurable menus, fonts, colors, and actions. You may customize this file to alter the default behavior of xterm on your system. These settings can also be overridden by resource settings contained in your own .Xdefaults file, located in your home directory.

On the Exam

You should be familiar with at least one of the popular X terminal programs available on your Linux system. Remember that some programs have system-wide configuration files that can be used to fine-tune their behavior and appearance.

18.5.3 X Libraries

Just as many executable programs are dependent upon shared system libraries for their execution, most X applications require a number of X-specific libraries. XFree86 comes bundled with the necessary set of libraries for traditional X applications. However, many graphical programming projects are created using toolkits whose libraries are not included in the XFree86 distribution. In these cases, you need to install the required libraries before programs requiring them will compile or execute.

For example, the GIMP Toolkit (GTK) is used to build much of the GNOME desktop environment. This means that GTK must be installed on the system in order to run GNOME applications, including The GIMP (http://www.gimp.org/).

Library dependency issues typically occur when you try new software. Either the compiler fails as you attempt to build the program, or the loader fails when you try to run a precompiled dynamic binary. In either case, you need to locate the correct version of the libraries and install them. It should be relatively easy to find recent versions of the popular libraries in your distribution's package format by visiting web sites of the library distributor or your Linux distribution.

To manually check for library dependencies, you may use the ldd utility, described fully in Section 14.4.

18.5.4 Remote X Clients

One of the fundamental design elements of the X Window System is that it is a network protocol, which allows for displays to occur remotely across a network. Many sites employ high-powered systems for computation and use desktop X servers (X terminals or Linux systems, for example) for display rendering.

To send the output from an X application to a remote machine, you need to set the display environment variable.[9] This variable contains a description of the output destination and has three components:

[9] Many X programs also include a command-line option to select the display.

[host]:display[.screen]
host

This part of the description specifies the remote hostname on the network. It can be any valid hostname, fully qualified domain name, or IP address. host is optional; the local system is used if the host is not specified.

display

This specifies which display the output should be directed toward. A single system can manage many displays. Note that the colon is required even if the host is omitted.

screen

This optional parameter is used for multiheaded systems (i.e., systems with more than one monitor) and specifies on which output screen the application will appear.

Setting display to "point to" a remote host display causes all subsequent X applications to be displayed there. For example:

# export DISPLAY=yourhost:0.0 # xterm

In this example, the xterm is displayed on the first display on yourhost.[10]

[10] This example ignores X authentication issues.

18.5.4.1 Examples

The default display on the local host:

:0

The default display on a remote host:

yourhost:0

Display programs on the first screen of the second display found on the machine located at 192.168.1.2:

192.168.1.2:1.0

Display programs on the first screen of the third display on yourhost:

yourhost:2.0

On the Exam

You must be familiar with the display environment variable and how to use it to direct X client applications to remote X servers.

 


LPI Linux Certification in a Nutshell
LPI Linux Certification in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596005288
EAN: 2147483647
Year: 2000
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net