This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Running a simple GUI app


Sorry Phil if my questions seem 'lame'.  I should have explained that I only
installed Cygwin this morning so I'm by no means up to speed with the
concepts or terminology.

Anyway, I managed to arrange Windows so that it now starts X at boot up.
This means that I can use a (DOS) console window to navigate to the
appropriate directory, type 'HelloWorld' and my HelloWorld app launches
with X just running silently in the background.  That's a lot slicker than
the procedure I was using a few hours ago.  Thanks for the suggestion.

What's strange though is that I can't just double-click on the app's icon
and launch it.  There's a (slim) chance that this could be a Windows problem
but I've never known any other Windows app that can be started from a
command line but can't be started by clicking its icon.  Any ideas?

John



----- Original Message ----- From: "Phil Betts" <Phil.Betts@ascribe.com>
To: <cygwin-xfree@cygwin.com>
Sent: 18 August 2008 16:41
Subject: RE: Running a simple GUI app



John Emmas wrote on Monday, August 18, 2008 4:55 PM::


Hi there,

After installing Cygwin (under WinXP) I've got to the stage of
compiling a very simple "Hello World" app which just displays an
empty GTK dialog with the title "Hello World".  To run the app I
(currently) have to start Cygwin (using its desktop icon), type
"startx" into the DOS terminal (which opens a second terminal
window), navigate to the folder containing my executable and finally
type "./HelloWorld".  Obviously this is all a bit convoluted.  Is
there a simpler way to launch my app - for example:-

a)  Double clicking on an icon, or
b)  Issuing some command (from a DOS terminal) that would launch the
app - but starting Cygwin and X invisibly.

Thanks,

John

First, there's no such concept as "starting Cygwin". Cygwin is just a DLL. If you mean "start a bash session", there's no need to do that just to run an X program.


You could* write a bash script along the lines of:


-------- /path/to/runyourprog -------
#!/bin/bash --login

checkx || startx
exec yourprogname
-------------------------------------

The --login should ensure that the environment is set up correctly.

Then you can create a shortcut with a target of:

C:\cygwin\bin\bash -c /path/to/runyourprog


* This is very much a lame Windows-user type of thing to be doing. Xwin is a SERVER. It should not be started by running a client. If you were to ask a linux mailing list for a way to switch runlevel if someone tried to run your program without an X server, you would rightly expect the electronic equivalent of howls of derision.

Why do you not just start X when you log on?  If you'd rather not
start X every time you log on, you only need to start it the first
time you try to run an X program.  Any properly written X program
(including yours) should tell the user if it cannot connect to the
X server, so if you get this message, you just need to run the
server - once, then try again.

Phil

--
This email has been scanned by Ascribe PLC using Microsoft Antigen for
Exchange.

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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]