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 <aborodin@vmail.ru>
This commit is contained in:
Sergey Y. Afonin 2012-12-18 09:43:06 +04:00 committed by Andrew Borodin
parent 6c6ce83af7
commit 42f54a0a32
9 changed files with 24 additions and 9 deletions

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)

View File

@ -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}"
;;
*)