xorg XWin.exe: Can I get rid of extra console?

Walters, I (Iestyn) I.Walters@rl.ac.uk
Tue Apr 13 13:02:00 GMT 2004


Holger Krull wrote:

> Hello,
> we had this in the "6.7.0.0 XWin w/out -nodecoration running in
> background doesn't display anything" thread. At least to get rid of the
> extra window, i don't know if this changes the hotkey problem.

Great thread, but you're right, it doesn't solve the hotkey problem. The
Windows Shell seems to remember the main program window started by a
shortcut hotkey. If you press the hotkey a second time, Windows tries to
activate the window in some way. If that particular window has disappeared
however, it will try to start a second instance of the program (I seem to
remember there was a bug in (win32) gvim related to this awhile back).

I have a fix that will do for now:

 The Shortcut attached to my preferred hotkey (Ctrl+Alt+/) runs:

    \cygwin\usr\X11R6\bin\run.exe C:\bin\Xfghack.exe

[Dunno what run.exe does, but a console window momentarily flashes by
without it.] Xfghack is a short C program:

    HWND w = FindWindow (0, "Cygwin/X - 0:0");
    return w? !SetForegroundWindow(w): system ("setsid XWin -clipboard &");

Works nicely. (The thread you pointed out above helpfully mentions both
setsid and run, so thanks for that!)

I was going to write "The real solution of course is for XWin to have an
option not to create the console window...," but Xfghack is slightly more
useful in that it will bring the X session to the front even if it wasn't
originally started by the Windows Shell via the shortcut, or even if the
window has not got a title bar (I couldn't use -nodecoration before).

The things you learn, eh?
Cheers,
-- 
mailto:i.walters@rl.ac.uk
CCLRC e-Science Centre, RAL, UK. OX11 0QX



More information about the Cygwin-xfree mailing list