From 7c4851c8d6d033b461d5b591b18649e90de70f06 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 31 Jul 2019 07:04:23 +1200 Subject: [PATCH] bgrun: use delayed cleanup hack --- .mutt/bgrun | 9 +++++++++ .mutt/mailcap.backgrounding | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.mutt/bgrun b/.mutt/bgrun index c51ea90..82e1748 100755 --- a/.mutt/bgrun +++ b/.mutt/bgrun @@ -90,4 +90,13 @@ case "$SELF" in wait cleanup ;; + (bgrun-delay) + # hack to stay around for a fixed period of time after the viewer process + # returns control to the caller, so that we can clean up. This is for + # cases when the FIFO method doesn't work, because e.g. Firefox randomly + # chooses it needs to read HTML files twice. + FILE="$(get_file "${1:-}")" + (launch_viewer "$MIMETYPE" "${FILE}" && notify_output) & + (sleep 1m && cleanup) & + ;; esac diff --git a/.mutt/mailcap.backgrounding b/.mutt/mailcap.backgrounding index 9ffa551..22f6884 100644 --- a/.mutt/mailcap.backgrounding +++ b/.mutt/mailcap.backgrounding @@ -1,7 +1,7 @@ # # Mutt mailcap for backgrounding -text/html; ~/.mutt/bgrun-fifo %t; description=Open file in browser via FIFO +text/html; ~/.mutt/bgrun-delay %t; description=Open file in browser via FIFO application/*; ~/.mutt/bgrun %t %s; description=Backgrounded run of run-mailcap image/*; ~/.mutt/bgrun %t %s; description=Backgrounded run of run-mailcap audio/*; ~/.mutt/bgrun %t %s; description=Backgrounded run of run-mailcap -- 2.39.5