summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-03 13:02:33 (GMT)
committerGitHub <noreply@github.com>2020-06-03 13:02:33 (GMT)
commit5b8787ef191864cd2313015959bcc3e10711aaff (patch)
tree79c2e3946a22fd66e4679632befa707a4ee4f998
parent139f1bafcf0bf48f8f55464523a4c5e50ddb50fd (diff)
downloadcpython-5b8787ef191864cd2313015959bcc3e10711aaff.zip
cpython-5b8787ef191864cd2313015959bcc3e10711aaff.tar.gz
cpython-5b8787ef191864cd2313015959bcc3e10711aaff.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.pyGH-L292) Let me know if something doesn't match the PR guidelines. This is my first PR in the python source code. (cherry picked from commit c822efeda9a0afe87cf3429724732fc8e19a01fb) Co-authored-by: Jeremy Attali <jeremy.attali@gmail.com>
-rwxr-xr-xLib/webbrowser.py2
-rw-r--r--Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rst3
2 files changed, 4 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)
diff --git a/Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rst b/Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rst
new file mode 100644
index 0000000..4bebb31
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rst
@@ -0,0 +1,3 @@
+:mod:`webbrowser` now properly finds the default browser in pure Wayland
+systems by checking the WAYLAND_DISPLAY environment variable. Patch
+contributed by Jérémy Attali.