The DISPLAY Environment Variable (Unix Power Tools, 3rd Edition)
35.8. The DISPLAY Environment Variable
The most important environment
variable for X Window System clients is DISPLAY. When a user logs in
at an X terminal, the DISPLAY environment variable in each
xterm window is set to her X
terminal's hostname followed by
:0.0.
ruby:joan % echo $DISPLAY
ncd15.ora.com:0.0
When the same user logs in at the console of the workstation named
sapphire that's running X, the
DISPLAY environment variable is defined as just
:0.0:[104]
[104]Before X11 Release 5, the
DISPLAY variable might appear as unix:0.0.
sapphire:joan % echo $DISPLAY
:0.0
The DISPLAY environment variable is used by all X clients to
determine what X server to display on. Since any X client can connect
to any X server that allows it, all X clients need to know what
display to connect to upon startup. If DISPLAY is not properly set,
the client cannot execute:
sapphire:joan % setenv DISPLAY foo:0
sapphire:joan % xterm
xterm Xt error: Can't open display:
You can override the value of DISPLAY by using the
-display command-line option. For example:
sapphire:joan % xterm -display sapphire:0.0 &
The first part of the display name (up to and including the colon)
identifies the type of connection to use and the host that the server
is running on. The second part (in most cases, the string
0.0) identifies a
server number and an optional screen
number. In most cases, the server and screen numbers will
both be 0. You can omit the screen number name if the default (screen
0) is correct.
Note that we used both :0.0 and
sapphire:0.0 to access the local console display
of the workstation named sapphire. Although both
these names will work, they imply different ways of connecting to the
X server.
The : character without an initial hostname specifies that the client
should connect using UNIX domain sockets (IPC).
Since processes can communicate via IPC only if they are running on
the same host, you can use a leading colon or the
unix keyword in a display name only if both the
client and server are running on the same host -- that is, for
local clients displaying to the local console display of a
workstation.
Using the hostname followed by a colon (e.g.,
sapphire:) specifies that the client should
connect using Internet domain sockets (TCP/IP). You can use TCP/IP
connections for displaying clients on any X server on the TCP/IP
network, as long as the client has permission to access that server.
Note that like all other environment variables set in your shell
environment, the DISPLAY environment variable will propagate (Section 35.3) to
all processes you start from that shell.
When you run clients from remote machines, some additional problems
with the DISPLAY environment variable need to be addressed. See
Section 6.10 for more information on running
remote clients.
--LM and EP
35.7. PATH and path35.9. Shell Variables
Copyright © 2003 O'Reilly & Associates. All rights reserved.
Wyszukiwarka
Podobne podstrony:
ch35ch35!ch35ch35CH35 (4)ch35CH35ch35ch35ch35ch35ch35ch35ch35ch35&ch35#ch35więcej podobnych podstron