This is the mail archive of the
cygwin-xfree
mailing list for the Cygwin XFree86 project.
Re: xterm
>> Make sure the X server is running first (run 'startxwin').
> >
> > This might not sufficient - at least it is not in my system:
> > Even when you start the X server (in my case in multiwindow
> > mode), but then try to start xterm from a CMD Cygwin shell
> > (such as from the shell you get when opening the Cygwin
> > icon which is created by default when you setup Cygwin initially),
> > you get the above error message.
Well, sure.
X allows individual programs running on one computer to display
selectively on a different one over the network, which is quite handy.
You can also have multiple X servers running on the same host, thanks
to things like virtual consoles, Xnest, Xvnc, etc.
But that means that an X client can't safely make assumptions about
where the X server is. So you have to tell it.
You do this by supplying a display identifier string. In the usual
case, a single X server on the same machine as the program, the
display identifier is almost always ":0".
How do you provide this information? The usual way is by setting the
environment variable DISPLAY. If you have a shell that was started up
by an X program (like xterm or rxvt), that shell will inherit the
value of DISPLAY (if you type "echo $DISPLAY" you will see it). So
that shell can automatically start up X programs; they will show up on
the same display as the window you type their command in.
However, a plain Cygwin shell running in a Windows command window has
no knowledge of X by default, and no DISPLAY variable set. So when
you try to run an X program it complains about not being able to open
the display - because you haven't told it which display to open. (Not
the most informative error message, and it probably ought to default
to :0, but I'm just the messenger. :))
You can tell each program manually where to display:
$ xterm -display :0
Or you can just set DISPLAY yourself first:
export DISPLAY=:0
If you're always (or almost always) going to have X running, you can
put the export command in your .bash_profile so that you can always
start X programs. But that can cause difficulties - some programs,
such as vim, behave differently when DISPLAY is set, and may hang for
a while trying to get some information about the X environment if
DISPLAY is set when X isn't really running.
--
Mark J. Reed <markjreed@mail.com>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/