summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorJeremy Attali <jeremy.attali@gmail.com>2020-06-03 12:42:33 (GMT)
committerGitHub <noreply@github.com>2020-06-03 12:42:33 (GMT)
commitc822efeda9a0afe87cf3429724732fc8e19a01fb (patch)
tree7ff5d75174b62bdfce1f853a7944974e107df04a /Lib/webbrowser.py
parentfa7ab6aa0f9a4f695e5525db5a113cd21fa93787 (diff)
downloadcpython-c822efeda9a0afe87cf3429724732fc8e19a01fb.zip
cpython-c822efeda9a0afe87cf3429724732fc8e19a01fb.tar.gz
cpython-c822efeda9a0afe87cf3429724732fc8e19a01fb.tar.bz2
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
Would be nice to backport to python 3.7+. I don't think it's worth the hassle to backport this all the way down to 3.10. But I'll let the maintainers decide. This is hard to test because the test setup already includes this [environment variable](https://github.com/python/cpython/blob/master/Lib/test/pythoninfo.py#L292) Let me know if something doesn't match the PR guidelines. This is my first PR in the python source code.
Diffstat (limited to 'Lib/webbrowser.py')
-rwxr-xr-xLib/webbrowser.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 9c73bcf..3dcf66b 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -545,7 +545,7 @@ def register_standard_browsers():
register(browser, None, BackgroundBrowser(browser))
else:
# Prefer X browsers if present
- if os.environ.get("DISPLAY"):
+ if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"):
try:
cmd = "xdg-settings get default-web-browser".split()
raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)