Using X Window
Last revision August 6, 2004
Table of Contents: |
Starting X Window client programs
X Window clients are programs like any other Unix program. That means that they have to be started either directly by another program (as from an initialization file or shell script), or by being typed in on the command line of a login shell, just like any other program. If you are logged into an X session, the X Window manager (such as CDE) may provide on-screen graphical menus that you can use to start standard X client programs.
If starting X client programs from the command line of a login window (or xterm window), remember to start them in the background (that is, with the & symbol at the end of the command line). Each should run as a detached process, interacting through its own window. If you start an X client in the foreground, then your login shell will be tied up waiting until that one client exits.
When you work on a Unix workstation with integrated graphics display and X server, or when your remote server (X terminal or PC) connects to a Unix system via the XDMCP protocol to start an X session, your standard X clients are generally run on that same Unix computer and started for you automatically (via the .xsession file, for example). One of those standard clients is usually an xterm window providing a login shell.
However, X client programs can run on any computer on the network and be directed to communicate with the X server on any other computer. From your workstation display, you can remotely log into another Unix computer and start an X client there pointing back to your workstation. The same thing is done (perhaps by telnet or a remote command facility) when your X server display is a PC or Macintosh.
The key issue for running an X client on a remote computer is telling the X client how to get back to the local workstation (or PC or Mac) which is running the X server.
All X clients accept a standard option for designating the X server to use, in the form:
-display hostname:n.m
Where hostname is the network hostname, qualified with domain name as needed (or use the IP address directly); n is the display number on that host (usually 0); and m is the screen number on that host (usually 0). For example, if you am logged into the console on the workstation eluard and want to run the xload client on pangea with the output window coming back to eluard, you could start this program on pangea with the option:
xload -display eluard:0.0
If the -display option is not given to a client, then it will check to see if the environment variable named DISPLAY is set, and use that value. This variable is automatically set when you use the XDMCP protocol to connect a remote X server to a Unix computer. The xterm client also always tries to set this DISPLAY variable, so one good way to run X clients on a remote machine when you do not want the full login environment provided by XDMCP is to first start an xterm client pointed back to your display with the -display option, and then start all other X clients from within that xterm login session.
Finally, if the -display option is not given, and the DISPLAY variable is not set, then an X client will attempt to connect to the locally attached X display (localhost:0.0), if there is one, or fail otherwise.