threads / patch / 35207

patchweb--browse: Add support for xdg-open.

Subject: [PATCH] web--browse: Add support for xdg-open.

## tl;dr

One message between Oct 26, 2013 and Oct 26, 2013. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Rüdiger Sonderfeld· Oct 26, 2013, 17:43 UTC · lore

xdg-open is a tool similar to git-web--browse. It opens a file or URL in the user's preferred application. It could probably be made default at least on Linux with a graphical environment.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 Documentation/git-web--browse.txt | 1 +
 git-web--browse.sh                | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
Show changes to 2 files +4 −3

Documentation/git-web--browse.txt, git-web--browse.sh

diff --git a/Documentation/git-web--browse.txt b/Documentation/git-web--browse.txt
index 5aec4ec..2de575f 100644
--- a/Documentation/git-web--browse.txt
+++ b/Documentation/git-web--browse.txt
@@ -35,6 +35,7 @@ The following browsers (or commands) are currently supported:
 * open (this is the default under Mac OS X GUI)
 * start (this is the default under MinGW)
 * cygstart (this is the default under Cygwin)
+* xdg-open
 
 Custom commands may also be specified.
 
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 1d72ec7..ebdfba6 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -34,7 +34,7 @@ valid_tool() {
 	firefox | iceweasel | seamonkey | iceape | \
 	chrome | google-chrome | chromium | chromium-browser | \
 	konqueror | opera | w3m | elinks | links | lynx | dillo | open | \
-	start | cygstart)
+	start | cygstart | xdg-open)
 		;; # happy
 	*)
 		valid_custom_tool "$1" || return 1
@@ -112,7 +112,7 @@ fi
 
 if test -z "$browser" ; then
 	if test -n "$DISPLAY"; then
-		browser_candidates="firefox iceweasel google-chrome chrome chromium chromium-browser konqueror opera seamonkey iceape w3m elinks links lynx dillo"
+		browser_candidates="firefox iceweasel google-chrome chrome chromium chromium-browser konqueror opera seamonkey iceape w3m elinks links lynx dillo xdg-open"
 		if test "$KDE_FULL_SESSION" = "true"; then
 			browser_candidates="konqueror $browser_candidates"
 		fi
@@ -179,7 +179,7 @@ konqueror)
 		;;
 	esac
 	;;
-w3m|elinks|links|lynx|open|cygstart)
+w3m|elinks|links|lynx|open|cygstart|xdg-open)
 	"$browser_path" "$@"
 	;;
 start)
-- 
1.8.4.1

← back to recent threads