Flylib.com

Books Software

 
 
 

5.3 Running X11

5.3 Running X11

X11 can be run in two modes: full screen or rootless (the default). Both of these modes run side-by-side with Aqua, although full-screen mode hides the Finder and Mac OS X's desktop (to hide X11 and return to the Finder, press Option- figs/command.gif -A).

To launch the X server, double-click the X11 application (in /Applications/Utilities ). An xterm window that looks similar to a Mac OS X Terminal window opens, sporting Aqua-like buttons for closing, minimizing, and maximizing the window. Also, X11 windows minimize to the Dock, just like other Aqua windows . Figure 5-1 shows a Terminal window and an xterm window side-by-side.

Figure 5-1. A Terminal and an xterm sporting the Aqua look
figs/mug2_0501.gif

If you're using the default configuration, you'll also notice three obvious differences from a Terminal window. In particular:

  • The xterm window has a titlebar that reads "xterm"

  • The xterm window does not have vertical and horizontal scrollers

  • The xterm window doesn't have a split window option

A less obvious difference between a Terminal window and an X11 xterm window is that Control-clicking (or right-clicking) in an xterm window does not invoke the same contextual menu that it does in a Terminal window. Control-clicking, Control-Option-clicking, and Control- figs/command.gif -clicking in an xterm invokes xterm -specific contextual menus , as shown inFigure 5-2, Figure 5-3, and Figure 5-4. If you have a three-button mouse, Control-clicking with the right mouse button does the same thing as Control- figs/command.gif -clicking; Control-clicking with the middle button does the same thing as Control-Option-clicking.

You can use Fink to install an xterm replacement such as rxvt or eterm . See Chapter 11 for more information on Fink.

Figure 5-2. Control-click (or Control-left-click) in an xterm window
figs/mug2_0502.gif
Figure 5-3. Control-Option-click (or Control-middle-click) in an xterm window
figs/mug2_0503.gif
Figure 5-4. Control- figs/command.gif -click (or Control-right-click) in an xterm window
figs/mug2_0504.gif

Mac OS X emulates right-mouse clicks with Control-click. In X11, you can configure key combinations that simulate two- and three-button mice.

By default, Option-click simulates the middle mouse button, and figs/command.gif -click simulates the right mouse button. You can use X11 Preferences to enable or disable this, but you cannot change which key combinations are used (although you can use xmodmap as you would under any other X11 system to remap pointer buttons).


In rootless mode, X11 applications take up their own window on your Mac OS X desktop. In full-screen mode, X11 takes over the entire screen and is suitable for running an X11 desktop environment (DTE) like GNOME, KDE, or Xfce. If you want to run X11 in full-screen mode, you'll have to enable this mode in the X11 Preferences by clicking the Output tab and selecting the full-screen mode checkbox.

You can still access your Mac OS X desktop while in full-screen mode by pressing Option- figs/command.gif -A. To go back to the X11 desktop, bring X11 to the front by clicking its icon in the Dock or using figs/command.gif -Tab, and press Option- figs/command.gif -A.


5.4 Customizing X11

There are a number of things you can customize in X11. For example, you can customize your xterm window, set X11 application preferences, customize the X11 application and Dock menus , and specify which window manager to use.

5.4.1 Dot-files, Desktops, and Window Managers

To customize X11, you can create an .xinitrc script in your Home directory. A sample .xinitrc script is provided in /etc/X11/xinit/xinitrc .

Using the script as a starting point, you can specify which X11-based applications to start when X11 is launched, including which window manager you'd like to use as your default. The default window manager for X11 is the Quartz window manager (or quartz-wm ). The tab window manager (or twm ) is also bundled with X11, but many other window managers are available. You can visit the following web sites to get instructions and binaries for a wide variety of window managers and DTEs.


Fink

http://fink. sourceforge .net


DarwinPorts

http://darwinports.opendarwin.org


GNU-Darwin

http://gnu-darwin.sourceforge.net


OroborOSX

http://oroborosx.sourceforge.net

If you're going to use your own .xinitrc file and want to use the Quartz window manager, make sure you start the Quartz window manager with the command:

exec /usr/X11R6/bin/quartz-wm &

Once you've installed X11, you will probably want to install additional X11 applications, window managers, and perhaps other DTEs (even if you are using Apple's window manager, you can still run most binaries from other DTEs such as GNOME and KDE even without using that DTE as your desktop). One of the easiest ways to install additional window managers is to use Fink. Table 5-1 lists some of the window managers and desktops that can be installed via Fink. (For information on installing and updating Fink, see Chapter 11.)

Table 5-1. Window managers available for Fink

Window manager/desktop

Fink package name

Blackbox

blackbox

Enlightenment

enlightenment

FVWM

fvwm, fvwm2

GNOME

bundle-gnome

IceWM

icewm

KDE

bundle-kde

mwm

lesstif

Oroborus

oroborus, oroborus2

PWM

pwm

Sawfish

sawfish

Window Maker

windowmaker

XFce

xfce


Fink has entire sections (http://fink.sourceforge.net/pdb/sections.php) devoted to GNOME and KDE, where you will find an extensive set of libraries, utilities, and plug-ins. Also included in the GNOME section are GTK+, glib , and Glade. Installing GNOME and KDE may be especially useful if you want to develop software for these desktops.

Fink installs everything in its /sw directory. So, for example, if you've installed lesstif and want to use the mwm window manager, you must include /sw/bin in your path , or include /sw/bin/mwm & in your .xinitrc file to start the Motif window manager. However, if you've installed Fink according to its instructions, /sw/bin will already be in your path (see Chapter 11).

You can customize the xterm window in Apple's X11 in the same way you would customize xterm on any other system running X11. You can, for example, set resources in an .Xdefaults file in your home directory or use escape sequences to set the title bar (see Section 1.4.1 in Chapter 1).

5.4.2 X11 Preferences, Application Menu, and Dock Menu

You can also customize your X11 environment by setting X11's preferences via the X11 Preferences window ( figs/command.gif -,) and adding programs to its Application menu. X11's preferences are organized into three categories: Input, Output, and Security. The X11 preferences are described in Table 5-1 and have the following options:

5.4.2.1 Input

The following options are used for controlling how X11 interacts with input devices:


Emulate three-button mouse

Determines whether Option-click and figs/command.gif -click mimic the middle and right buttons .


Follow system keyboard layout

Allows input menu changes to overwrite the current X11 keymap .


Enable key equivalents under X11

Enabled menu bar key equivalents, which may interfere with X11 applications that use the Meta modifier.

By default, all three of these options are enabled.

5.4.2.2 Output

The following options are used for configuring X11's look and feel:


Colors

This pop-up menu offers the following options:

  • From Display

  • 256 Colors

  • Thousands

  • Millions

By default, the Color pop-up is set to "From Display"; if you change this setting to something else, you will need to relaunch X11 for the change to take effect.


Full-screen mode

This option is unchecked by default. When unchecked, X11 runs in rootless mode, which means that X11 windows can reside side-by-side with Aqua windows . In full-screen mode, use Option- figs/command.gif -A to toggle full-screen X11 and Aqua.


Use system alert effect

Determines whether X11's beeps will use the system alert, as specified in the Sound Effects System Preference. If unchecked, X11 windows will use a standard Unix system beep to sound an alert.

5.4.2.3 Security

The following options are used to configure X11's security features:


Authenticate connections

Determines whether X11 creates Xauthority access-control keys. If the system's IP address changes, you should relaunch X11, since the old keys will become invalid.


Allow connections from network clients

If you use this option, be sure to select Authenticate connections to ensure the security of your system. If this is disabled, remote applications won't be able to connect.

Both of these settings are checked by default. If you make any changes to these settings, you must quit and restart X11 for the change to take effect.

5.4.2.4 Customizing X11's Applications menu

X11's Applications menu can be used to quickly launch X11 applications, so you don't have to enter their command path. You can add other X11 applications to this menu and assign keyboard shortcuts by selecting Applications Customize to bring up the X11 Application Menu dialog window, shown in Figure 5-5.

Figure 5-5. X11 Application Menu customization window
figs/mug2_0505.gif

The same X11 Application Menu customization window can be opened by Control-clicking on X11's Dock icon and selecting Customize from the contextual menu. When you Control-click on X11's Dock icon, you will see that the applications shown in Figure 5-5 are listed there as well. X11's context menu allows you to quickly launch other X11 applications and to switch between windows of currently running X11 applications.