Subject: Re: bug#54333: 29.0.50; browse-url-chrome in Wayland/pgtk

From: Po Lu <[email-masked]>
Date: Fri, 11 Mar 2022 09:49:22 +0800

Po Lu <[email-masked]> writes:

> Indeed.  I'll look into that, thanks.

Does this patch solve the problem?

diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 6d28e318ff..776f774172 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -970,7 +970,13 @@ browse-url-process-environment
 environment, otherwise just use the current environment."
   (let ((display (or browse-url-browser-display (browse-url-emacs-display))))
     (if display
-	(cons (concat "DISPLAY=" display) process-environment)
+	(cons (concat (if (and (eq window-system 'pgtk)
+                               (equal (pgtk-backend-display-class)
+                                      "GdkWaylandDisplay"))
+                          "WAYLAND_DISPLAY="
+                        "DISPLAY=")
+                      display)
+              process-environment)
       process-environment)))
 
 (defun browse-url-emacs-display ()