From: martin f. krafft Date: Tue, 30 Jul 2019 19:04:23 +0000 (+1200) Subject: bgrun: use delayed cleanup hack X-Git-Url: https://git.madduck.net/etc/mutt.git/commitdiff_plain/7c4851c8d6d033b461d5b591b18649e90de70f06?ds=inline;pf=etc bgrun: use delayed cleanup hack --- 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