octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI starts up with terminal


From: John W. Eaton
Subject: Re: GUI starts up with terminal
Date: Fri, 24 Aug 2012 06:58:07 -0400

On 23-Aug-2012, Mike Miller wrote:

| On Thu, Aug 23, 2012 at 05:22:42PM -0400, John W. Eaton wrote:
| > I started looking at this.  It's not too hard to separate the command
| > line option processing from the rest of the startup code, but that
| > doesn't solve the whole problem.
| > 
| > I'd like to be able to run Octave from a terminal as always, except
| > that now it will start the GUI by default.  That should not be too
| > hard to do.  However, we need to know when we can avoid starting the
| > GUI, for example when there is a filename specified on the command
| > line or when I/O is coming from a pipe or redirected from a file:
| > 
| >  1. octave myfile.m
| >  2. echo "x = 1" | octave
| >  3. octave < myfile.m
| 
| Slight aside, after reading this, and not using 2 and 3 myself, I see
| that octave does not support the "-" argument convention to indicate
| stdin, it rather tries to load a file named "-". I think that's worth
| handling also.

Why is that needed?  I've typically seen that for programs that can
accept multiple file names on the command line, but Octave only
accepts one, so I'm not sure I see why we would want to write

  echo "x = 1" | octave -

| How about the arguably different case
| 
|   4. octave < /dev/null

I don't think this is any different from redirection from any other
file, except that there is nothing to read from the special /dev/null
file.  And, of course, the shell handles the redirection, so Octave
doesn't ever see the file name in this case.  It only knows that it is
reading from stdin and that it is not a tty.

| which may be a somewhat reliable discriminator for running from a
| launcher. I assume this would be treated like an empty script and Octave
| will exit at EOF, that makes the most sense to me.
| 
| I wish there were a way to detect "started from a launcher panel" but I
| think it's effectively the same as "octave < /dev/null".

Yes, and that's why it seems impossible to tell the difference.

| How about testing argv[0] to see if it is "octave-gui" and treat it like
| --force-gui? Then you have octave, which can be either CLI or GUI,
| octave-cli, and octave-gui.

I'd prefer to avoid changing behavior based on what the program is
named.  That is not how octave-cli works.  It's a completely different
binary that is not even linked with the GUI toolkit.

If we were to have a separate octave-gui binary, I guess I would have
it skip the tests for input from stdin or a file name passed as command
line argument and always start the GUI.  But I don't know whether that
is really necessary given that we have the --force-gui option.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]