Why normal notebook created from script minimizes automatically?

157 Views Asked by At

The code is simple:

#!/usr/local/bin/math -script
UsingFrontEnd[FE=$FrontEnd];
Unprotect[$FrontEnd];
$FrontEnd=FE;
nb= NotebookOpen["/home/src/math/test.nb",Visible->True];
Pause[10]

But window of Notebook is first minimized, and when clicked (unminimized) then it immediately minimizes again automaticaly. When I use Option WindowFrame->ModelessDialog it stays, but I do not know why only in this case. Can anybody explain me a bit this behavior. I'm using math few days and do not know how to find this in documentation. Thanks. P.S. I'm using Debian 6 with Gnome and Trial version of Mathematica 8 works well.

1

There are 1 best solutions below

1
On

When the FrontEnd is launched by the kernel to provide these types of services it is passed "-server" (which is similar to "-nogui"). According to ref/program/mathematica-unix:

-nogui prevent the display of any kind of window or dialogues

If you call

Developer`InstallFrontEnd["Server"->False]

first then you won't get the "-server" behavior which is causing the notebook to automatically minimize.