Skip to content

Commit 5926c67

Browse files
committed
webbrowser: accept gtk4-launch
1 parent 90f7574 commit 5926c67

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Lib/webbrowser.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,16 @@ def _locate_xdg_desktop(name: str) -> str | None:
461461

462462
def register_X_browsers():
463463

464-
# use gtk-launch to launch preferred browser by name, if found
464+
# use gtk[4]-launch to launch preferred browser by name, if found
465465
# this should be _before_ xdg-open, which doesn't necessarily launch a browser
466-
if _os_preferred_browser and shutil.which("gtk-launch"):
467-
register(
468-
"gtk-launch",
469-
None,
470-
BackgroundBrowser(["gtk-launch", _os_preferred_browser, "%s"]),
471-
)
466+
if _os_preferred_browser:
467+
for gtk_launch in ("gtk4-launch", "gtk-launch"):
468+
if shutil.which(gtk_launch):
469+
register(
470+
gtk_launch,
471+
None,
472+
BackgroundBrowser([gtk_launch, _os_preferred_browser, "%s"]),
473+
)
472474

473475
# use xdg-open if around
474476
if shutil.which("xdg-open"):

0 commit comments

Comments
 (0)