unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 9779@debbugs.gnu.org
Subject: bug#9779: No usable browser found on Lubuntu
Date: Tue, 18 Oct 2011 09:55:03 +0300	[thread overview]
Message-ID: <87y5wi3i0s.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwvipnnkqvd.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 17 Oct 2011 21:53:39 -0400")

> 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	other threads:[~2011-10-18  6:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 23:14 bug#9779: No usable browser found on Lubuntu Juri Linkov
2011-10-18  1:53 ` Stefan Monnier
2011-10-18  6:55   ` Juri Linkov [this message]
2011-10-18  8:12     ` Lawrence Mitchell
2011-10-18  9:09       ` Juri Linkov
2011-10-18  9:53       ` Jan Djärv
2011-10-18  9:04     ` Juri Linkov
2011-10-18 10:06       ` Jan Djärv
2011-10-18  9:58     ` Jan Djärv
2011-10-19  9:12       ` Juri Linkov
2011-10-19 14:52         ` Jan Djärv
2011-10-19 22:42           ` Juri Linkov
2011-10-18 13:17     ` Stefan Monnier
2011-10-18  5:37 ` Jan Djärv
2011-10-18  6:57   ` Juri Linkov
2011-10-18 13:16     ` Stefan Monnier
2011-10-19  9:10       ` Juri Linkov
2011-10-20 14:47     ` Nix
2011-10-20 18:41       ` Stefan Monnier
2011-10-20 20:08         ` Nix
2011-10-21 11:25           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y5wi3i0s.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=9779@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).