Launching a web browser from Squeak?

David T. Lewis lewis at mail.msen.com
Fri May 12 02:59:00 UTC 2006


On Thu, May 11, 2006 at 05:38:02PM -0400, John Maloney wrote:
> Does anyone know how to launch a Web browser from within Squeak? I need 
> to be able to pass the URL to the browser to open. It would be really 
> great if I could also tell the browser how big to be and where to open 
> on the screen.
> 
> I realize the solution will probably be highly platform dependent; I'm 
> interesting in solutions for Windows, Macs, and Linux.
> 
> I'd be grateful for any tips or hints.

I don't know of a cross-platform way to do it, but for Unix VMs you
can for example inspect this:

   "OSProcess command: 'konqueror http://www.squeak.org'"
  or:
   "OSProcess command: 'mozilla http://www.squeak.org'"

The web browser is going to be running in an independent process
managed by whatever X window manager the user might happen to be
using, so in general you should not expect to have much control
over its size and placement. Once the external browser program
is running, you can kill it from Squeak, but that is about all
the control you will have.

Many X programs allow initial size and position to be specified
with the "-geometry" command line parameter (see "man X" man
page on most any unix system for an explanation). I did not look
carefully, but this did not seem to have any useful effect on the
web browsers I tried. In any case, on the off chance that it
did work on some browser of interest, the expression might
look something like this:

  "OSProcess command 'foobrowser -geometry 600x400+40+20 http://www.squeak.org'"

Of course Squeak does not know anything about the coordinate system
of the X display on which it resides, so attempting to control
the geometry may be a bad idea regardless. X makes more or less
the same assumptions that Squeak does: the user is in control of
of the UI, and programs should not attempt to "help" the user
by making assumptions about window placement etc.

It is hard to know in advance what web browsers are available,
as there are many available and this is likely to vary according
to the flavor of Unix/Linux/BSD and the individual preferences of
the user. Also, OSProcess must be installed from SqueakMap, which
would not be a default configuration for most users.

Dave




More information about the Squeak-dev mailing list