From e3689b52b1524fe64aa43ac9abd75d3ac071c3aa Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Sun, 15 Dec 2024 22:00:00 +0000 Subject: [PATCH] Ticket #4615: web.sh - select browser at runtime Current browser selection happen on compile time and should change to runtime selection. - add chromium browser to list - bonus: remove shellcheck warning Signed-off-by: Andreas Mohr Signed-off-by: Yury V. Zaytsev --- configure.ac | 4 ---- misc/ext.d/Makefile.am | 9 ++++----- misc/ext.d/{web.sh.in => web.sh} | 9 +++++++-- 3 files changed, 11 insertions(+), 11 deletions(-) rename misc/ext.d/{web.sh.in => web.sh} (73%) mode change 100644 => 100755 diff --git a/configure.ac b/configure.ac index 2acd2b33e..ae7aafdd3 100644 --- a/configure.ac +++ b/configure.ac @@ -213,9 +213,6 @@ if $HAVE_FILECMD; then fi fi -dnl Only list browsers here that can be run in background (i.e. with `&') -AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera]) - dnl ############################################################################ dnl Check for other tools @@ -608,7 +605,6 @@ misc/ext.d/Makefile misc/ext.d/doc.sh misc/ext.d/misc.sh misc/ext.d/text.sh -misc/ext.d/web.sh misc/macros.d/Makefile misc/mc.ext.ini diff --git a/misc/ext.d/Makefile.am b/misc/ext.d/Makefile.am index f92bb07ea..235eb1096 100644 --- a/misc/ext.d/Makefile.am +++ b/misc/ext.d/Makefile.am @@ -3,21 +3,20 @@ extdir = $(EXTHELPERSDIR) SCRIPTS_IN = \ doc.sh.in \ misc.sh.in \ - text.sh.in \ - web.sh.in + text.sh.in SCRIPTS_OUT = \ doc.sh \ misc.sh \ - text.sh \ - web.sh + text.sh SCRIPTS_UNTOUCHED = \ archive.sh \ image.sh \ package.sh \ sound.sh \ - video.sh + video.sh \ + web.sh ext_SCRIPTS = \ $(SCRIPTS_UNTOUCHED) \ diff --git a/misc/ext.d/web.sh.in b/misc/ext.d/web.sh old mode 100644 new mode 100755 similarity index 73% rename from misc/ext.d/web.sh.in rename to misc/ext.d/web.sh index 17d7e6354..41d516f2a --- a/misc/ext.d/web.sh.in +++ b/misc/ext.d/web.sh @@ -28,8 +28,13 @@ do_open_action() { case "${filetype}" in html) - (if [ -n "@X11_WWW@" -a -n "$DISPLAY" ]; then - (@X11_WWW@ file://"${MC_EXT_CURRENTDIR}"/"${MC_EXT_BASENAME}" &) 1>&2 + (if [ -n "$DISPLAY" ]; then + for browser in gnome-moz-remote mozilla firefox chromium google-chrome konqueror brave-browser opera open ; do + if which "${browser}" 1>&2 ; then + "${browser}" file://"${MC_EXT_CURRENTDIR}"/"${MC_EXT_BASENAME}" 1>&2 & + break + fi + done else elinks "${MC_EXT_FILENAME}" || \ links "${MC_EXT_FILENAME}" || \