FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-113539: Enable using ``$BROWSER`` to reorder default seach order in webbrowser.py by ronaldoussoren · Pull Request #113561 · python/cpython · GitHub

Repository navigation

gh-113539: Enable using $BROWSER to reorder default seach order in webbrowser.py - #113561

Merged
hugovk merged 9 commits into
python:mainfrom
ronaldoussoren:gh-113539
Apr 25, 2025
Merged

hugovk merged 9 commits into
python:mainfrom
ronaldoussoren:gh-113539

Conversation

ronaldoussoren commented Dec 29, 2023 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

This PR makes it possible to use $BROWSER to reorder the list of registered (default) browsers, instead of always interpreting values as command-line tools.

The PR also fixes the registration for "chrome" on macOS, the app name is "google chrome" (and has been for years)

This is particularly useful on macOS where the default way to start a browser is not a command-line tool.


📚 Documentation preview 📚: https://cpython-previews--113561.org.readthedocs.build/

Comment thread Doc/library/webbrowser.rst Outdated
Comment thread Lib/webbrowser.py Outdated
Comment thread Lib/webbrowser.py Outdated
Comment thread Doc/library/webbrowser.rst Outdated
ronaldoussoren and others added 5 commits December 29, 2023 11:14
…Dkv9O.rst

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should we add a usage example somewhere? This feature is rather hard to comprehend.

Copy link
Copy Markdown
Contributor Author

Should we add a usage example somewhere? This feature is rather hard to comprehend.

The feature was hard to fully comprehend even before I made it more complex :-(

Adding some examples would definitely help, and it would be even better to slightly restructure the description of this feature. I'll see if I can come up with a better description.

BTW. Some other things I noticed (for different PRs):

  1. The list of supported browsers on macOS is not complete, we should at least add support for Microsoft Edge and possibly other popular non-mainstream browsers like Brave and Chromium.
  2. The table below the description of webbrowser.register is not correct for macOS, e.g. "chrome" is registered as MacOSXOSAScript("google chrome") and not Chrome('chrome')

hugovk commented Dec 29, 2023

Copy link
Copy Markdown
Member
  1. The list of supported browsers on macOS is not complete, we should at least add support for Microsoft Edge and possibly other popular non-mainstream browsers like Brave and Chromium.

Not limited to macOS, but from the Plausible trial in July, here are the most popular browsers of people visiting docs.python.org:

Also not limited to macOS, here are the most popular desktop browsers used worldwide, from statscounter:

And visitors to usa.gov sites (json), for macOS:

"Macintosh": {
"Safari": 260849550,
"Chrome": 201103500,
"Firefox": 16103981,
"Edge": 2024170,
"Mozilla Compatible Agent": 2018923,
"Opera": 552767,
"YaBrowser": 36155,
"Whale Browser": 15131,
"DuckDuckGo Browser": 5801,
"Coc Coc": 10339,
"SeaMonkey": 4535,
"Aloha Browser": 3174,
"Maxthon": 4181,
"Mozilla": 2253,
"Internet Explorer": 5163,
"Waterfox": 1837,
"PaleMoon": 139,
"(not set)": 215,
"Vivaldi": 748
},

minrk commented Feb 21, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

Given how the mac launchers work, I think it would also be sensible for $BROWSER to accept application names, as the standard way to launch a URL with browser is e.g. open -a 'Google Chrome' URL (equivalent for tell application in current osascript implementation).

e.g.

if shutil.which(cmd[0]):
  # on the command-line
  GenericBrowser
else:
  # maybe check if app exists?
  OSAScript(app_name)

I'm not sure what the right backward-compatibility story is, or if that's appropriate if $BROWSER is a standard env expected to point to a shell executable.

Comment thread Doc/library/webbrowser.rst Outdated

hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the PR, I added a What's New entry based on the blurb.

hugovk merged commit 25e4984 into python:main Apr 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL