Bug 35500 - Default for $BROWSER under Mac OS X
Summary: Default for $BROWSER under Mac OS X
Status: RESOLVED FIXED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.0
Hardware: Other Mac OS X (All)
: low enhancement
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-03-21 02:38 UTC by jmv16
Modified: 2011-03-31 08:05 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description jmv16 2011-03-21 02:38:05 UTC
Hi all --

xdg-open dies unhappily on OS X because $BROWSER is not set in the standard configuration, and it can't find any browser in an expected location.

I found the following elegant solution:

setenv BROWSER open

because there is a standard OS X command for this sort of thing (passes URLs to user's choice of webbrowser, opens documents in corresponding application) e.g. `open http://www.apple.com/`.


Perhaps a nice default if $BROWSER is not set but on OS X (e.g. $OSTYPE = darwin, or `uname` = Darwin) is to just pass the URL along to `open`.


-Jeff
Comment 1 jmv16 2011-03-21 02:39:40 UTC
This is version 1.0.1 by the way.
Comment 2 Rex Dieter 2011-03-21 04:48:40 UTC
What would help (esp coming from someone with access and knowledge of OSX),
1.  A scriptable way to identify osx platform.  for example, see detectDE() function in xdg-open.
2.  For osx platform, suggested values for $BROWSER , or even suggested specialized open_osx function(s).
Comment 3 jmv16 2011-03-21 19:20:51 UTC
Rex --

I thought I provided answers to both of these questions?

My sh coding skils are too rusty to supply entire code fragments, but you can identify OS X by the $OSTYPE environment variable or by the output of `uname`, and by far the most sensible value for $BROWSER is simply "open" which will recognize a URL commandline argument and pass it to the user's default browser.  Hopefully that's enough info for someone else to code it up.

-Jeff
Comment 4 Rex Dieter 2011-03-31 07:41:24 UTC
ok, if uname output is indeed 'Darwin' , we can utilize that.
Comment 6 Rex Dieter 2011-03-31 08:05:11 UTC
So far, this only implements the mapping of
xdg-open => open
on Darwin platform, and doesn't touch any other utilities.

There's further work to be done to integrate the other bits.

One thing we could consider is setting BROWSER=open in the meantime as suggested (but not implemented).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.