From 01d2bdf31001b0f6553af586ed334eedddf7bcc3 Mon Sep 17 00:00:00 2001
From: "Yury V. Zaytsev" <yury@shurup.com>
Date: Thu, 29 Aug 2024 09:35:11 +0200
Subject: [PATCH] Ticket #4479: prioritize console players for audio/video and
images
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
---
misc/ext.d/image.sh | 13 +++++++++----
misc/ext.d/sound.sh | 2 +-
misc/ext.d/video.sh | 16 ++++------------
3 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/misc/ext.d/image.sh b/misc/ext.d/image.sh
index c191225c8..a99c137b1 100755
a
|
b
|
|
6 | 6 | action=$1 |
7 | 7 | filetype=$2 |
8 | 8 | |
9 | | [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" |
| 9 | [ [ -n "$DISPLAY" ] && [ -n "${MC_XDG_OPEN}" ] ] || MC_XDG_OPEN="xdg-open" |
10 | 10 | |
11 | 11 | do_view_action() { |
12 | 12 | filetype=$1 |
… |
… |
do_open_action() { |
50 | 50 | else |
51 | 51 | (gqview "${MC_EXT_FILENAME}" &) |
52 | 52 | fi |
53 | | elif which see >/dev/null 2>&1; then |
54 | | (see "${MC_EXT_FILENAME}" &) |
| 53 | elif which fim >/dev/null 2>&1; then |
| 54 | (fim "${MC_EXT_FILENAME}") |
| 55 | elif which fbi >/dev/null 2>&1; then |
| 56 | (fbi "${MC_EXT_FILENAME}") |
| 57 | elif which zgv >/dev/null 2>&1; then |
| 58 | (zgv "${MC_EXT_FILENAME}") |
55 | 59 | else |
56 | | (zgv "${MC_EXT_FILENAME}" &) |
| 60 | echo "Please install either fim or fbi to view this file" |
| 61 | return |
57 | 62 | fi |
58 | 63 | ;; |
59 | 64 | esac |
diff --git a/misc/ext.d/sound.sh b/misc/ext.d/sound.sh
index 60a3cdd52..125e9b045 100755
a
|
b
|
|
6 | 6 | action=$1 |
7 | 7 | filetype=$2 |
8 | 8 | |
9 | | [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" |
| 9 | [ [ -n "$DISPLAY" ] && [ -n "${MC_XDG_OPEN}" ] ] || MC_XDG_OPEN="xdg-open" |
10 | 10 | |
11 | 11 | do_view_action() { |
12 | 12 | filetype=$1 |
diff --git a/misc/ext.d/video.sh b/misc/ext.d/video.sh
index 9cba21020..01b0ddda0 100755
a
|
b
|
|
6 | 6 | action=$1 |
7 | 7 | filetype=$2 |
8 | 8 | |
9 | | [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" |
| 9 | [ [ -n "$DISPLAY" ] && [ -n "${MC_XDG_OPEN}" ] ] || MC_XDG_OPEN="xdg-open" |
10 | 10 | |
11 | 11 | do_view_action() { |
12 | 12 | filetype=$1 |
… |
… |
do_open_action() { |
29 | 29 | filetype=$1 |
30 | 30 | |
31 | 31 | if which mpv >/dev/null 2>&1; then |
32 | | PLAYER=mpv |
| 32 | PLAYER="mpv --really-quiet" |
33 | 33 | elif which mplayer >/dev/null 2>&1; then |
34 | | PLAYER=mplayer |
| 34 | PLAYER="mplayer -really-quiet" |
35 | 35 | else |
36 | 36 | echo "Please install either mplayer or mpv to play this file" |
37 | 37 | return |
38 | 38 | fi |
39 | 39 | |
40 | | case "${filetype}" in |
41 | | *) |
42 | | if [ -n "$DISPLAY" ]; then |
43 | | ($PLAYER "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) |
44 | | else |
45 | | $PLAYER -vo null "${MC_EXT_FILENAME}" |
46 | | fi |
47 | | ;; |
48 | | esac |
| 40 | (clear && $PLAYER "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) |
49 | 41 | } |
50 | 42 | |
51 | 43 | case "${action}" in |