From 42f54a0a329c06c33f1eb438c71391e34ff37341 Mon Sep 17 00:00:00 2001 From: "Sergey Y. Afonin" Date: Tue, 18 Dec 2012 09:43:06 +0400 Subject: [PATCH] Implement quick and easy disable of xdg-open usage. MC_XDG_OPEN=/bin/false can be used to disable xdg-open usage in /usr/libexec/mc/ext.d/*.sh scripts. Signed-off-by: Andrew Borodin --- misc/ext.d/archive.sh | 4 +++- misc/ext.d/doc.sh.in | 3 ++- misc/ext.d/image.sh | 4 +++- misc/ext.d/misc.sh.in | 4 +++- misc/ext.d/package.sh | 3 ++- misc/ext.d/sound.sh | 4 +++- misc/ext.d/text.sh.in | 4 +++- misc/ext.d/video.sh | 3 ++- misc/ext.d/web.sh.in | 4 +++- 9 files changed, 24 insertions(+), 9 deletions(-) diff --git a/misc/ext.d/archive.sh b/misc/ext.d/archive.sh index b533f0557..2264b1243 100644 --- a/misc/ext.d/archive.sh +++ b/misc/ext.d/archive.sh @@ -8,6 +8,8 @@ action=$1 filetype=$2 pager=$3 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" + do_view_action() { filetype=$1 @@ -141,7 +143,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" "${pager}" ;; *) diff --git a/misc/ext.d/doc.sh.in b/misc/ext.d/doc.sh.in index 79fc381a8..bfecfc0bc 100644 --- a/misc/ext.d/doc.sh.in +++ b/misc/ext.d/doc.sh.in @@ -6,6 +6,7 @@ action=$1 filetype=$2 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" STAROFFICE_REGEXP='\.(sxw|sdw|stw|sxc|stc|sxi|sti|sxd|std||sxm||sxg)$' @@ -186,7 +187,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" ;; *) diff --git a/misc/ext.d/image.sh b/misc/ext.d/image.sh index 21fc9ecf2..61e3bc212 100644 --- a/misc/ext.d/image.sh +++ b/misc/ext.d/image.sh @@ -6,6 +6,8 @@ action=$1 filetype=$2 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" + do_view_action() { filetype=$1 @@ -52,7 +54,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" ;; *) diff --git a/misc/ext.d/misc.sh.in b/misc/ext.d/misc.sh.in index 80776bf0c..f5da9ffc0 100644 --- a/misc/ext.d/misc.sh.in +++ b/misc/ext.d/misc.sh.in @@ -6,6 +6,8 @@ action=$1 filetype=$2 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" + do_view_action() { filetype=$1 @@ -86,7 +88,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" ;; *) diff --git a/misc/ext.d/package.sh b/misc/ext.d/package.sh index 0a28cb79f..442287966 100644 --- a/misc/ext.d/package.sh +++ b/misc/ext.d/package.sh @@ -6,6 +6,7 @@ action=$1 filetype=$2 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" do_view_action() { filetype=$1 @@ -50,7 +51,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" ;; *) diff --git a/misc/ext.d/sound.sh b/misc/ext.d/sound.sh index 913bf23c3..4536a653d 100644 --- a/misc/ext.d/sound.sh +++ b/misc/ext.d/sound.sh @@ -6,6 +6,8 @@ action=$1 filetype=$2 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" + do_view_action() { filetype=$1 @@ -82,7 +84,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" ;; *) diff --git a/misc/ext.d/text.sh.in b/misc/ext.d/text.sh.in index 65211a5ca..81f3b8ec9 100644 --- a/misc/ext.d/text.sh.in +++ b/misc/ext.d/text.sh.in @@ -8,6 +8,8 @@ action=$1 filetype=$2 pager=$3 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" + get_unpacker() { filetype=$1 case "${filetype}" in @@ -131,7 +133,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" "${pager}" ;; *) diff --git a/misc/ext.d/video.sh b/misc/ext.d/video.sh index 3fad53138..36643e2ed 100644 --- a/misc/ext.d/video.sh +++ b/misc/ext.d/video.sh @@ -6,6 +6,7 @@ action=$1 filetype=$2 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" do_view_action() { filetype=$1 @@ -42,7 +43,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" ;; *) diff --git a/misc/ext.d/web.sh.in b/misc/ext.d/web.sh.in index f7531449c..866d9ac50 100644 --- a/misc/ext.d/web.sh.in +++ b/misc/ext.d/web.sh.in @@ -6,6 +6,8 @@ action=$1 filetype=$2 +[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" + do_view_action() { filetype=$1 @@ -44,7 +46,7 @@ view) do_view_action "${filetype}" ;; open) - xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \ + "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \ do_open_action "${filetype}" ;; *) -- 2.11.4.GIT