bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#9779: No usable browser found on Lubuntu


From: Juri Linkov
Subject: bug#9779: No usable browser found on Lubuntu
Date: Tue, 18 Oct 2011 09:55:03 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (x86_64-pc-linux-gnu)

> Better would be if we can use xdg-open.  Could you check if xdg-open
> works, and if so, how to adjust browse-url-can-use-xdg-open accordingly?

`browse-url-can-use-xdg-open' returns nil.  Below are expressions
from this function and results of their evaluation:

(getenv "DISPLAY")
=> ":0"

(executable-find "xdg-open")
=> "/usr/bin/xdg-open"

(executable-find "nohup")
=> "/usr/bin/nohup"

(getenv "GNOME_DESKTOP_SESSION_ID")
=> nil

(call-process "dbus-send" nil nil nil
              "--dest=org.gnome.SessionManager"
              "--print-reply"
              "/org/gnome/SessionManager"
              "org.gnome.SessionManager.CanShutdown")
=> 1

(getenv "KDE_FULL_SESSION")
=> nil

(call-process "/bin/sh" nil nil nil
              "-c"
              "xprop -root _DT_SAVE_MODE|grep xfce4")
=> 1

The latest is used to check for Xfce4, but it doesn't work for LXDE,
and I can't find a reliable value specific to LXDE or Lubuntu in the output
of `xprop -root' or among environment variables.

There are two desktop session modes: "Lubuntu" (with look&feel of Ubuntu)
and "LXDE" (pure LXDE desktop).

Some relevant environment variables when logged in as "Lubuntu":

DEFAULTS_PATH=/usr/share/gconf/Lubuntu.default.path
DESKTOP_SESSION=Lubuntu
GTK_MODULES=canberra-gtk-module:canberra-gtk-module
SAL_USE_VCLPLUGIN=gtk
UPSTART_JOB=lxdm
XDG_CONFIG_DIRS=/etc/xdg/lubuntu/:/etc/xdg/xdg-Lubuntu:/etc/xdg:/etc/xdg
XDG_CURRENT_DESKTOP=LXDE
XDG_MENU_PREFIX=lxde-

Some relevant environment variables when logged in as "LXDE":

DEFAULTS_PATH=/usr/share/gconf/LXDE.default.path
DESKTOP_SESSION=LXDE
GTK_MODULES=canberra-gtk-module:canberra-gtk-module
SAL_USE_VCLPLUGIN=gtk
UPSTART_JOB=lxdm
XDG_CONFIG_DIRS=/etc/xdg/xdg-LXDE:/etc/xdg
XDG_CURRENT_DESKTOP=LXDE
XDG_MENU_PREFIX=lxde-

The value of "DESKTOP_SESSION" looks like an arbitrary name of the
current session (the same string as displayed on the Login menu).

It seems that "XDG_CURRENT_DESKTOP" is the most reliable variable
to determine whether the current desktop is LXDE.

So I propose the following patch (that also adds a missing customizable
option for `browse-url-xdg-open' in `browse-url-browser-function'):

=== modified file 'lisp/net/browse-url.el'
--- lisp/net/browse-url.el      2011-08-21 01:01:12 +0000
+++ lisp/net/browse-url.el      2011-10-18 06:54:01 +0000
@@ -247,6 +249,8 @@ (defcustom browse-url-browser-function
                         :value browse-url-default-windows-browser)
          (function-item :tag "Default Mac OS X browser"
                         :value browse-url-default-macosx-browser)
+         (function-item :tag "Preferred by xdg-open from Free Desktop"
+                        :value browse-url-xdg-open)
          (function-item :tag "GNOME invoking Mozilla"
                         :value browse-url-gnome-moz)
          (function-item :tag "Default browser"
@@ -924,7 +946,7 @@ (defun browse-url-default-browser (url &
    url args))
 
 (defun browse-url-can-use-xdg-open ()
-  "Check if xdg-open can be used, i.e. we are on Gnome, KDE or xfce4."
+  "Check if xdg-open can be used, i.e. we are on 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
@@ -947,7 +969,8 @@ (defun browse-url-can-use-xdg-open ()
                      "/bin/sh" nil nil nil
                      "-c"
                      "xprop -root _DT_SAVE_MODE|grep xfce4"))
-            (error nil)))))
+            (error nil))
+          (equal (getenv "XDG_CURRENT_DESKTOP") "LXDE"))))
 
 





reply via email to

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