Skip to content

[Feat] Support BROWSER environmental variable #890

@wenzeslaus

Description

@wenzeslaus

GRASS GIS should support, i.e., understand the environmental variable BROWSER. Many other tools use it to set web browser and GRASS GIS should too. These include webbrowser package from Python standard library, Google Earth, or man:

              ...The choice of browser is determined by the optional
              browser argument if one is provided, by the $BROWSER environment variable, or
              by  a  compile-time default if that is unset (usually lynx)...

There is now GRASS_HTML_BROWSER variable which lib/init/grass.py uses to get a browser required by the user. A conservative solution (not changing the API) is to just use it as an override of BROWSER and then use GRASS_HTML_BROWSER internally.

The tricky part is that in some cases, BROWSER can be multiple commands or paths (see the webbrowser package documentation).

Describe alternatives you've considered

  1. Not supporting it like right now and telling users to set additional variable for GRASS GIS.
  2. Making GRASS_HTML_BROWSER only internal variable and using only BROWSER in the interface. (This is easiest to implement. This and the following ones would need to be done before 8.0 release.)
  3. Dropping the GRASS_HTML_BROWSER variable completely in favor of BROWSER (in all code). (I think this would be actually pretty good unless somebody has some use case which requires GRASS_HTML_BROWSER.)
  4. Replacing any direct use of the browser by Python webbrowser package.

Additional context

This suggestion was originally made as a part of Trac ticket 3964 by @jidanni. See also Trac ticket 3957 on issues with the browser variable.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions