2012-03-07 04:20:30 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# $1 - action
|
|
|
|
# $2 - type of file
|
|
|
|
|
|
|
|
action=$1
|
|
|
|
filetype=$2
|
|
|
|
|
2012-12-18 09:43:06 +04:00
|
|
|
[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open"
|
|
|
|
|
2012-03-07 04:20:30 +04:00
|
|
|
do_view_action() {
|
|
|
|
filetype=$1
|
|
|
|
|
|
|
|
case "${filetype}" in
|
|
|
|
jpeg)
|
2015-12-31 18:15:12 +03:00
|
|
|
identify "${MC_EXT_FILENAME}"
|
|
|
|
which exif >/dev/null 2>&1 && exif "${MC_EXT_FILENAME}" 2>/dev/null
|
2012-03-07 04:20:30 +04:00
|
|
|
;;
|
|
|
|
xpm)
|
|
|
|
sxpm "${MC_EXT_FILENAME}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
identify "${MC_EXT_FILENAME}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
do_open_action() {
|
|
|
|
filetype=$1
|
|
|
|
|
|
|
|
case "${filetype}" in
|
|
|
|
xbm)
|
2014-04-24 15:59:07 +04:00
|
|
|
(bitmap "${MC_EXT_FILENAME}" &)
|
2012-03-07 04:20:30 +04:00
|
|
|
;;
|
|
|
|
xcf)
|
|
|
|
(gimp "${MC_EXT_FILENAME}" &)
|
|
|
|
;;
|
2012-09-23 10:53:32 +04:00
|
|
|
svg)
|
|
|
|
(inkscape "${MC_EXT_FILENAME}" &)
|
|
|
|
;;
|
2012-03-07 04:20:30 +04:00
|
|
|
*)
|
2012-06-26 16:39:31 +04:00
|
|
|
if [ -n "$DISPLAY" ]; then
|
2019-01-21 19:50:04 +03:00
|
|
|
if which geeqie >/dev/null 2>&1; then
|
|
|
|
(geeqie "${MC_EXT_FILENAME}" &)
|
|
|
|
else
|
|
|
|
(gqview "${MC_EXT_FILENAME}" &)
|
|
|
|
fi
|
2020-10-09 00:59:32 +03:00
|
|
|
elif which see >/dev/null 2>&1; then
|
2012-10-05 12:24:30 +04:00
|
|
|
(see "${MC_EXT_FILENAME}" &)
|
2012-06-26 16:39:31 +04:00
|
|
|
else
|
2014-04-24 15:59:07 +04:00
|
|
|
(zgv "${MC_EXT_FILENAME}" &)
|
2012-03-07 04:20:30 +04:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
case "${action}" in
|
|
|
|
view)
|
|
|
|
do_view_action "${filetype}"
|
|
|
|
;;
|
|
|
|
open)
|
2016-02-14 08:40:57 +03:00
|
|
|
("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
|
2012-03-07 04:20:30 +04:00
|
|
|
do_open_action "${filetype}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|