Starting X server and checkX

2007-07-24 Thread Angelo Graziosi

Following this discussion

  http://cygwin.com/ml/cygwin-xfree/2006-07/msg00131.html

I have tried to modify the script in this way (to start X+urxvt):


-
#!/bin/bash

start_XWin()
{
#export DISPLAY=127.0.0.1:0.0
export DISPLAY=:0
#export PATH=/usr/X11R6/bin:$PATH
export XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults
export XCMSDB=/usr/X11R6/lib/X11/Xcms.txt
export XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
export XNLSPATH=/usr/X11R6/lib/X11/locale

# Cleanup from last run.
rm -rf /tmp/.X11-unix

XWin -multiwindow -clipboard -silent-dup-error +bs 
}

/usr/bin/checkX || start_XWin

exec /usr/bin/urxvt -e /usr/bin/bash -l
-


The aim of

  /usr/bin/checkX || start_XWin

should be that if X is not running start_XWin should be executed.

If X is running, start_XWin is avoided.


But when I try to open other URXVT windows, there is the Cygwin/X error:

   A fatal error has occurred and Cygwin/X now exit...


This mean that start_XWin is always executed.

So, How to solve this?


When X is running, 'checkX' return 0 (from checkX --help), so WHY


 A   B
   /usr/bin/checkX || start_XWin

should work ?

(In C/C++ if A is 0, B is always executed; if A != 0 then B is never
executed... or NOT?)



Cheers,

   Angelo.

--
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/



Re: Starting X server and checkX

2007-07-24 Thread Angelo Graziosi


Holger Krull wrote:

 My guess is, you have to set DISPLAY before you do checkX. How else
 would it know which X11 Server to search if it was not started as a
 child?

Obviously !!!

Now the script sound like this:
---
#!/bin/bash

##
## The DISPLAY MUST be set before
##

#export DISPLAY=127.0.0.1:0.0
export DISPLAY=:0

##
## If you want these variables defined for the shell,
## they MUST be defined here
##

#export PATH=/usr/X11R6/bin:$PATH
export XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults
export XCMSDB=/usr/X11R6/lib/X11/Xcms.txt
export XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
export XNLSPATH=/usr/X11R6/lib/X11/locale

## 

##
## FIRST method
##

start_XWin()
{
# Cleanup from last run.
rm -rf /tmp/.X11-unix

XWin -multiwindow -clipboard -silent-dup-error +bs 
}

/usr/bin/checkX || start_XWin

## 

##
## SECOND method
##

# /usr/bin/checkX || /usr/local/bin/start_XWin.sh

## 

exec /usr/bin/urxvt -e /usr/bin/bash -l
---


And it works fine.


Many thanks,

   Angelo.

--
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/