openbsd-ports/devel/xdg-utils/patches/patch-scripts_xdg-open
ajacoutot 7c4bb4c8f8 Merge a part from upstream commit that prefers gvfs-open over gnome-open so
that xdg-open works in both gnome2 and gnome3.
2011-05-19 18:35:43 +00:00

58 lines
1.7 KiB
Plaintext

$OpenBSD: patch-scripts_xdg-open,v 1.6 2011/05/19 18:35:43 ajacoutot Exp $
Merge part of:
From 79fe2261b0025b36515d17d3c22c162bf1c7efb3 Mon Sep 17 00:00:00 2001
From: Rex Dieter <rdieter@math.unl.edu>
Date: Fri, 16 Oct 2009 17:10:55 +0000
Subject: * prefer gvfs-open over gnome-open
--- scripts/xdg-open.orig Sun Jun 24 21:58:01 2007
+++ scripts/xdg-open Thu May 19 20:24:15 2011
@@ -338,7 +338,11 @@ open_kde()
open_gnome()
{
- gnome-open "$1"
+ if gvfs-open --help 2>/dev/null 1>&2; then
+ gvfs-open "$1"
+ else
+ gnome-open "$1"
+ fi
if [ $? -eq 0 ]; then
exit_success
@@ -364,7 +368,9 @@ open_generic()
for browser in $BROWSER; do
if [ x"$browser" != x"" ]; then
- browser_with_arg=`echo "$browser" | sed s#%s#"$1"#`
+ browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
+ if [ $? -ne 0 ]; then browser_with_arg=$browser;
+ fi
if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
else $browser_with_arg;
@@ -403,12 +409,21 @@ if [ -z "${url}" ] ; then
exit_failure_syntax "file or URL argument missing"
fi
+if which xdg-open-hook > /dev/null 2> /dev/null; then
+ xdg-open-hook "$url"
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
+fi
+
detectDE
if [ x"$DE" = x"" ]; then
# if BROWSER variable is not set, check some well known browsers instead
if [ x"$BROWSER" = x"" ]; then
- BROWSER=firefox:mozilla:netscape
+ BROWSER=firefox:chrome:midori:xxxterm:seamonkey:epiphany:opera:dillo:conkeror:kazehakase:konqueror:firefox36:firefox35
fi
DE=generic
fi