Skip to content

Commit 62b1460

Browse files
committed
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
1 parent 56853d8 commit 62b1460

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/webbrowser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ def register_standard_browsers():
545545
register(browser, None, BackgroundBrowser(browser))
546546
else:
547547
# Prefer X browsers if present
548-
if os.environ.get("DISPLAY"):
548+
if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"):
549549
try:
550550
cmd = "xdg-settings get default-web-browser".split()
551551
raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:mod:`webbrowser` now properly finds the default browser in pure Wayland
2+
systems by checking the WAYLAND_DISPLAY environment variable. Patch
3+
contributed by Jérémy Attali.

0 commit comments

Comments
 (0)