The patch for my suggested behavior actually turns out to be quite
trivial. Here's what I came up with:

-- >8 --
Subject: xdg-open: prefer BROWSER to xdg .desktop files

Earlier versions of xdg-utils would fall back to calling
sensible-browser, without looking for XDG .desktop files.
Newer versions do not call sensible-browser, but do look
at $BROWSER themselves. However, they do so only after
looking for .desktop files, which will generally find
at least one useful match.

However, this ignores the user's browser preference. Let's
try $BROWSER first, and if it is not set, then fall back
to the .desktop files.
---
 scripts/xdg-open.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in
index 13d352c..32ee444 100644
--- a/scripts/xdg-open.in
+++ b/scripts/xdg-open.in
@@ -311,10 +311,6 @@ open_generic()
         fi
     fi
 
-    if [ -n "$DISPLAY" ]; then
-        open_generic_xdg_x_scheme_handler "$1"
-    fi
-
     local oldifs="$IFS"
     IFS=":"
     for browser in $BROWSER; do
@@ -342,6 +338,10 @@ open_generic()
         fi
     done
 
+    if [ -n "$DISPLAY" ]; then
+        open_generic_xdg_x_scheme_handler "$1"
+    fi
+
     exit_failure_operation_impossible "no method available for opening '$1'"
 }
 
-- 
2.6.0.rc2.440.g7728f87

Reply via email to