tags:

views:

220

answers:

2

I'm using Cygwin's startx and want to customize my xinitrc so that I don't get any "magic" X programs on screen, i.e., programs that will cause the X server to terminate if I exit them. I don't want any X programs to start up on screen at all, actually; I just want to use the XWin menu, customized from my .XWinrc .

Ordinarily from a .xinitrc, I would make the last line run the window manager. Then I can exit X by exiting the window manager from its own provided interface.

In this case, though my window manager and my server are effectively the same process, because I am using the XWin server. I don't have a windows manager to execute. I am starting the server from my .xserverrc file:

exec XWin -multiwindow -clipboard -silent-dup-error

I can sleep at the end of my .xinitrc, in a loop:

while [ 1 -eq 1 ]
do
  sleep 10
done

But that seems inelegant.

I can wait for a child process, either by starting it up as the last line in my .xinitrc, or by starting it up earlier in the background and waiting for it explicitly with "wait {PID}". But I can't wait for the XWin.exe process, because it is a parent process of my .xinitrc script, not a child process.

I can't start up XWin.exe at the end of .xinitrc; if I try, I get a different window manager apparently starting up, with XWin not in rootless mode, and then I get an immediate shutdown.

Is there a more elegant way to do this than sleeping in a loop? Is there a way to start XWin from my .xinitrc and wait on it? Is there a way to tell the .xinitrc shell script to simply wait and not exit, without sleeping, such that it will continue executing and do nothing until XWin.exe exits? Is there something I should be starting in the background as the last line of my .xinitrc, so as to give me a process to wait on without starting up an X program?

+1  A: 

I'm not sure exactly what you want to do, but I usually start the Cygwin X server as a scheduled task.

Start/Control Panel/System and Maintenance/Administrative Tools/Schedule tasks

and add a task

C:\cygwin\bin\XWin.exe -multiwindow -clipboard

to run at start up.

See also my web page: http://www.lemoda.net/cygwin/x-server/index.html

Ben Bullock
Well, starting without startx is pointing me in the right direction, but I miss some support infrastructure that way. It seems I have to do this: bash --login -c 'XWin -multiwindow -clipboard' and then I get most of what I want. Also, I'm still starting in a terminal; eliminating that will have to wait for another time, as starting as a scheduled task didn't work for me.
skiphoppy
A: 

So, summarizing from Ben Bullock's answer, the answer to "How do I make .xinitrc do this?" is "Don't!" Never ask "How do I use X to do Y?" questions. :) Skip startx/.xinitrc entirely.

skiphoppy