Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
webbrowser: accept gtk4-launch
  • Loading branch information
minrk committed Feb 27, 2025
commit 5926c67bdcded0b0e174ec490c8b3fe0e0a1e130
16 changes: 9 additions & 7 deletions Lib/webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,16 @@ def _locate_xdg_desktop(name: str) -> str | None:

def register_X_browsers():

# use gtk-launch to launch preferred browser by name, if found
# use gtk[4]-launch to launch preferred browser by name, if found
# this should be _before_ xdg-open, which doesn't necessarily launch a browser
if _os_preferred_browser and shutil.which("gtk-launch"):
register(
"gtk-launch",
None,
BackgroundBrowser(["gtk-launch", _os_preferred_browser, "%s"]),
)
if _os_preferred_browser:
for gtk_launch in ("gtk4-launch", "gtk-launch"):
if shutil.which(gtk_launch):
register(
gtk_launch,
None,
BackgroundBrowser([gtk_launch, _os_preferred_browser, "%s"]),
)

# use xdg-open if around
if shutil.which("xdg-open"):
Expand Down