[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

browse-url default browser

From: Florian Lindner
Subject: browse-url default browser
Date: Wed, 5 Apr 2017 09:51:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0


(browse-url "";) opens firefox, albeit my default broweser is 

xdg-open ""; 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
       (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
             (error nil))
           (equal (getenv "KDE_FULL_SESSION") "true")
           (condition-case nil
               (eq 0 (call-process
                      "/bin/sh" nil nil nil
                      ;; 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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]