aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar 0xACE <0xaced@gmail.com>2020-09-08 13:17:10 +0200
committerGravatar 0xACE <0xaced@gmail.com>2020-09-08 13:21:43 +0200
commit858794fd271b3714a8fe65c4dda3de913cce0e31 (patch)
tree61742bb5ee4afe5883b91590219f5dc02f6a2672
parentd11b07fd01cffe5901ba1cfca148224f1e7f16f0 (diff)
downloadnnn-858794fd271b3714a8fe65c4dda3de913cce0e31.tar.gz
preview-tabbed now kills lingering viewer
-rwxr-xr-xplugins/preview-tabbed11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/preview-tabbed b/plugins/preview-tabbed
index 9fefee1..6a55058 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