[GRASS-dev] init.sh OSX browser setting

William Kyngesburye woklist at kyngchaos.com
Thu Mar 8 12:06:56 EST 2007


[summary for list]

Two problems with the way GRASS opens help files in OSX:

Init.sh uses a plain 'open' as the default for the browser in Mac OS  
X.  This will open help files in whatever application a user has  
their system set to open html files in.  By default this is Safari,  
but it may not be a browser but a text editor (ie for those web  
programmers), and for viewing help that's not helpful.

And, if a user wants a different browser for GRASS (and doesn't want  
to change their general system default browser), the normal unix  
executable way is not right, that is setting, say, /Applications/ 
Firefox.app/Contents/MacOS/Firefox.  This opens the application, but  
if it's already running it opens another instance - not right on OSX.

The way to handle these problems is to add options to the open command:

open -a /path/to/app/package.app

or:

open -b app.signature

This causes a problem in the scripts, since $GRASS_HTML_BROWSER is  
quoted everywhere - it tries to execute "open -a /path/to/app/ 
package.app" as the name of a program, not "open".  So, I tried two  
ways to handle this.

[/summary]


So far I have (in init.sh):

- alias method - doesn't work, command not found

alias opengrasshelp='open -b com.apple.helpviewer'
GRASS_HTML_BROSWER=opengrasshelp
export GRASS_HTML_BROWSER

Help button in GUI startup and help menu in GUI and in command dialogs:

couldn't execute "opengrasshelp": no such file or directory

or if I try to run 'opengrasshelp' from the GRASS prompt:

bash: opengrasshelp: command not found


- script method - an extra etc script html_browser_mac.sh opens the  
help file in the browser set in GRASS_HTML_BROWSER_MACOSX

This works as a default browser:

GRASS_HTML_BROWSER="$ETC/html_browser_mac.sh"
GRASS_HTML_BROWSER_MACOSX="-b com.apple.helpviewer"
export GRASS_HTML_BROWSER_MACOSX
export GRASS_HTML_BROWSER

This also works:

GRASS_HTML_BROWSER_MACOSX="-b org.mozilla.firefox"

But this opens the default system browser:

GRASS_HTML_BROWSER_MACOSX="-a /Applications/Firefox.app"

It opens the default browser when used in the Help menu and dialogs,  
BUT works correctly if typed at the GRASS prompt, like:

 > $GRASS_HTML_BROWSER_MACOSX /path/to/some/hemp/file.html


I can use the browser signature method, and would prefer that - it's  
simpler for the user, and I can put tests in init.sh for common  
browsers so the user just needs to set GRASS_HTML_BROWSER to a  
name.   But I don't know the signatures for any other browser than  
Safari and Firefox, so those would have to be filled in.

I could force the signature method as the only method.  Leave  
browsers that I know as above, but for other browsers the user would  
have to figure out their signatures.

-----
William Kyngesburye <kyngchaos at kyngchaos.com>
http://www.kyngchaos.com/

First Pogril: Why is life like sticking your head in a bucket filled  
with hyena offal?
Second Pogril: I don't know.  Why IS life like sticking your head in  
a bucket filled with hyena offal?
First Pogril: I don't know either.  Wretched, isn't it?

-HitchHiker's Guide to the Galaxy


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20070308/c3979ea0/attachment.html


More information about the grass-dev mailing list