git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] git-web--browse: Use xdg-open if it is available

From
Todd Zullinger <tmz@pobox.com>
Date
Feb 8, 2009, 23:13 UTC
Message-ID
<505e3349e025bb4ac91fdfaa987a19cc729fa8fb.1234127422.git.tmz@pobox.com>
In-Reply-To
<e44161a223e7ec2cfb1f1b71399b995626c2d208.1234127422.git.tmz@pobox.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---

For now, I didn't remove any of the KDE specific hacks. It seemed better to add xdg-open and let it prove whether it's workable first.

Is testing for start and xdg-open based on their paths robust enough? Is there a more portable, preferred method to search for these programs in $PATH?

 git-web--browse.sh |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 7ed0fad..a72cd5b 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -31,7 +31,7 @@ valid_custom_tool()

 valid_tool() {
 	case "$1" in
-		firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start)
+		firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start | xdg-open)
 			;; # happy
 		*)
 			valid_custom_tool "$1" || return 1
@@ -118,6 +118,10 @@ if test -z "$browser" ; then
     if test -x /bin/start; then
 	browser_candidates="start $browser_candidates"
     fi
+    # Use xdg-open if it is available
+    if test -x /usr/bin/xdg-open; then
+	browser_candidates="xdg-open $browser_candidates"
+    fi

     for i in $browser_candidates; do
 	init_browser_path $i
@@ -161,7 +165,7 @@ case "$browser" in
 		;;
 	esac
 	;;
-    w3m|links|lynx|open|start)
+    w3m|links|lynx|open|start|xdg-open)
 	eval "$browser_path" "$@"
 	;;
     dillo)
-- 
1.6.1.3

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
He may look like an idiot and talk like an idiot but don't let that
fool you. He really is an idiot.
    -- Groucho Marx
Previous: Todd Zullinger
Message 2 of 2 in “git-web--browse: Fix check for /bin/start”
  1. 1/2 git-web--browse: Fix check for /bin/startTodd Zullinger, Feb 8, 2009
  2. 2/2 git-web--browse: Use xdg-open if it is availableTodd Zullinger, Feb 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.