Need help to replicate old behavior of my X setup scripts with latest Xfree86 update

Ben Richards
Tue Dec 23 18:24:00 GMT 2014

Up until the recent update to xinit-1.3.4-1 which overhauled X session
handling, I had my session set up nicely for my purposes. With the
following code in my .zshrc and an empty .startxwinrc, when I launched
Cygwin, Xwin.exe would start on display :0.0, it would set the
$DISPLAY variable, and automatically kill the X server when I exited
that terminal. I like mintty so this let me use that as my shell.

.zshrc contents:
startxwin &> xserver.log
if [[ $x_start_success == 0 ]]; then
   export DISPLAY=:0.0

   pid=`ps | grep '/usr/bin/XWin' | awk '{print $1;}'`
   alias kill_xwin="kill $pid"
   if [[ $TMUX == "" ]] && [[ $x_start_success == 0 ]]; then
    alias exit="kill $pid ; \exit"

The aforementioned update disrupted this flow so I’m wondering if
anyone has any suggestions on how I can regain a similar sort of
functionality. I don’t like using xterm in Cygwin and would like to
keep using mintty as my main terminal interface. Before, when I ran
startxwin it would launch the server and quit with an error status as
to whether it was successful or not, leaving Xwin.exe running in the
background. Now it stays in the foreground unless I specify otherwise.
However, my startup script relied on the assumption that Xwin.exe was
running by the time startxwinrc finished, which I cannot guarantee if
I run it as a background task. It also used the exit status where if
it was nonzero, I could assume that I already had X running and it
wouldn’t kill the server if I typed ‘exit’ to exit any subsequent
mintty windows I launched with Alt+F2.

I've tried various configurations and read through the man pages but
haven’t come up with an elegant solution other than the idea of
looping on the ‘ps’ until I see Xwin.exe in the list. Is there a
better way?


Benjamin Richards

Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list