## 9.6. AquaTerm

The X Window System is useful to Unix developers and users, since many Unix-based software packages depend on the X11 libraries. An interesting project that in some cases eliminates the need for the X windows is the BSD-licensed AquaTerm application, developed by Per Persson (http://aquaterm.sourceforge.net). AquaTerm is a Cocoa application that can display vector graphics in an X11-like fashion. It does not replace X11, but it is useful for applications that need to generate plots and graphs.

The output graphics formats that AquaTerm supports are PDF and EPS. Applications communicate with AquaTerm through an adapter that acts as an intermediary between your old application's API and AquaTerm's API.

At the time of this writing, AquaTerm has are adapters for gnuplot and PGPLOT, as well as example adapters in C, FORTRAN, and Objective-C. For example, assuming that you have installed both XFree86 and AquaTerm, you can build gnuplot (http://www.gnuplot.info) so that graphics can be displayed either in X windows or in AquaTerm windows.

There is extensive documentation on AquaTerm's web site (listed earlier in this section). Consult that site for the latest developments, examples, and other documentation.

### 9.6.1. Aqua-X11 Interactions

Since X11-based applications rely on different graphics systems even when running XDarwin in rootless mode, you would not necessarily expect to see GUI interactions run smoothly between these two graphics systems. But actually, there are several such interactions that run very well.

First, it is possible to open X11-based applications from the Terminal application. To launch an X11-based application from the Terminal application, you need to set the shell environment variable `DISPLAY` as follows for tcsh:

>     setenv DISPLAY 0:0

If you are using a Bourne-compatible shell, such as bash, you could use the following:

>     DISPLAY="0:0"; export DISPLAY

> TIP: You may want to add this functionality to your startup configuration script .tcshrc (for tcsh) or .bashrc (for bash).

You can also copy and paste between X11 and Mac OS X applications. For example, to copy from an xterm, select some text with your mouse. This action places the selected text into the Mac clipboard. To paste the contents of the clipboard into a Mac OS X application (such as the Terminal), simply press -V to paste the text.

To copy from a Mac OS X application, highlight some text and press -C. The copied text can be pasted into an xterm window by pressing the middle button of a three-button mouse or by Command-clicking in the X11 application.

> TIP: In Aqua, Mac OS X emulates right-mouse clicks with Control-click. In XDarwin, you can configure key combinations that simulate two- and three-button mice. By default, Option-click simulates the middle mouse button, and -click simulates the right mouse button. To configure this in XDarwin, choose Preferences from the XDarwin menu. In OroborOSX, choose XDarwin Preferences from the Options menu.

Copyright © 2003 O'Reilly & Associates. All rights reserved.