unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* browse-url default browser
@ 2017-04-05  7:51 Florian Lindner
  2017-04-05 15:50 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Lindner @ 2017-04-05  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

(browse-url "http://xgm.de") opens firefox, albeit my default broweser is chromium.

xdg-open "http://xgm.de" opens chromium, even when executed within Emacs eshell, all other applications do so, too.


browse-url calls browse-url-browser-function which defaults to browse-url-default-browser which uses xdg-open if
browse-url-can-use-xdg-open if true. And there I think is the problem.

(defun browse-url-can-use-xdg-open ()
  "Return non-nil if the \"xdg-open\" program can be used.
xdg-open is a desktop utility that calls your preferred web browser.
This requires you to be running either Gnome, KDE, Xfce4 or LXDE."
  (and (getenv "DISPLAY")
       (executable-find "xdg-open")
       ;; xdg-open may call gnome-open and that does not wait for its child
       ;; to finish.  This child may then be killed when the parent dies.
       ;; Use nohup to work around.  See bug#7166, bug#8917, bug#9779 and
       ;; http://lists.gnu.org/archive/html/emacs-devel/2009-07/msg00279.html
       (executable-find "nohup")
       (or (getenv "GNOME_DESKTOP_SESSION_ID")
	   ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also.
	   (condition-case nil
	       (eq 0 (call-process
		      "dbus-send" nil nil nil
				  "--dest=org.gnome.SessionManager"
				  "--print-reply"
				  "/org/gnome/SessionManager"
				  "org.gnome.SessionManager.CanShutdown"))
	     (error nil))
	   (equal (getenv "KDE_FULL_SESSION") "true")
	   (condition-case nil
	       (eq 0 (call-process
		      "/bin/sh" nil nil nil
		      "-c"
		      ;; FIXME use string-match rather than grep.
		      "xprop -root _DT_SAVE_MODE|grep xfce4"))
	     (error nil))
	   (member (getenv "DESKTOP_SESSION") '("LXDE" "Lubuntu"))
	   (equal (getenv "XDG_CURRENT_DESKTOP") "LXDE"))))



Why is xdg-open only used in Gnome, KDE, Xfce or LXDE? I'm using i3 and xdg-open works like it should.

Of course, I can set (setq browse-url-browser-function 'browse-url-default-browser) but I wonder why the defaults are
that way?

Thanks,
Florian




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: browse-url default browser
  2017-04-05  7:51 browse-url default browser Florian Lindner
@ 2017-04-05 15:50 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2017-04-05 15:50 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Florian Lindner <mailinglists@xgm.de>
> Date: Wed, 5 Apr 2017 09:51:47 +0200
> 
> Why is xdg-open only used in Gnome, KDE, Xfce or LXDE? I'm using i3 and xdg-open works like it should.
> 
> Of course, I can set (setq browse-url-browser-function 'browse-url-default-browser) but I wonder why the defaults are
> that way?

There's a long story behind this, but the important part is that the
function was heavily modified on the master branch, and no longer
limits the xdg applicability to only the above environments.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-05 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-05  7:51 browse-url default browser Florian Lindner
2017-04-05 15:50 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).