From 858794fd271b3714a8fe65c4dda3de913cce0e31 Mon Sep 17 00:00:00 2001 From: 0xACE <0xaced@gmail.com> Date: Tue, 8 Sep 2020 13:17:10 +0200 Subject: [PATCH] preview-tabbed now kills lingering viewer --- plugins/preview-tabbed | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/preview-tabbed b/plugins/preview-tabbed index 9fefee14..6a55058b 100755 --- a/plugins/preview-tabbed +++ b/plugins/preview-tabbed @@ -94,6 +94,12 @@ get_viewer_pid () { VIEWERPID="$(jobs -p %%)" } +kill_viewer () { + if [ -n "$VIEWERPID" ] && jobs -p | grep "$VIEWERPID" ; then + kill "$VIEWERPID" + fi +} + previewer_loop () { unset -v NNN_FIFO # mute from now @@ -123,9 +129,7 @@ previewer_loop () { continue fi - if [ -n "$VIEWERPID" ] && jobs -p | grep "$VIEWERPID" ; then - kill "$VIEWERPID" - fi + kill_viewer MIME="$(file -b --mime-type "$FILE")" @@ -188,6 +192,7 @@ previewer_loop () { fi done kill "$TABBEDPID" + kill_viewer } if [ ! -r "$NNN_FIFO" ] ; then