diff options
Diffstat (limited to 'modules/communication')
| -rw-r--r-- | modules/communication/neomutt/neomutt-launcher.sh | 7 | ||||
| -rw-r--r-- | modules/communication/neomutt/neomutt-sync-daemon.sh | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/modules/communication/neomutt/neomutt-launcher.sh b/modules/communication/neomutt/neomutt-launcher.sh index 62cbe09..c13677f 100644 --- a/modules/communication/neomutt/neomutt-launcher.sh +++ b/modules/communication/neomutt/neomutt-launcher.sh @@ -1,12 +1,7 @@ #!/usr/bin/env bash -# Wrapped neomutt: keeps the neomutt-sync systemd daemon alive for the -# lifetime of a neomutt session. +# Starts the neomutt-sync daemon before starting neomutt set -uo pipefail systemctl --user start neomutt-sync.service || true -stop_service() { - pgrep -x neomutt >/dev/null || systemctl --user stop neomutt-sync.service || true -} -trap stop_service EXIT "@@NEOMUTT_BIN@@" "$@" diff --git a/modules/communication/neomutt/neomutt-sync-daemon.sh b/modules/communication/neomutt/neomutt-sync-daemon.sh index a78ef5f..d148567 100644 --- a/modules/communication/neomutt/neomutt-sync-daemon.sh +++ b/modules/communication/neomutt/neomutt-sync-daemon.sh @@ -28,12 +28,15 @@ sync_once() { while true; do sync_once "$@" - sleep "$INTERVAL" # Safety net: the launcher stops this service when neomutt exits; if that # didn't happen (hard kill), bail out once neomutt is gone. - if ! pgrep -x neomutt >/dev/null; then + if ! pgrep -x neomutt-launche >/dev/null; then echo "neomutt is not running; stopping sync daemon" >&2 exit 0 fi + + # Sleep after syncing and trying to exit, this makes sure that it runs once + # after all neomutt instances closes + sleep "$INTERVAL" done |
