From 0c05b94504a4be08707d6e04867bfb418a6a31f1 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 17 Mar 2025 18:04:32 -0400 Subject: [PATCH] mail sync --- .config/mail/mail-sync.sh##hostname.dbox | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 .config/mail/mail-sync.sh##hostname.dbox diff --git a/.config/mail/mail-sync.sh##hostname.dbox b/.config/mail/mail-sync.sh##hostname.dbox new file mode 100755 index 00000000..3cd9e013 --- /dev/null +++ b/.config/mail/mail-sync.sh##hostname.dbox @@ -0,0 +1,28 @@ +#!/bin/sh + +PIPE="/tmp/email_refresh_pipe" + +# Create pipe if doesn't exist +[ -p "$PIPE" ] || mkfifo "$PIPE" + +MBSYNC=$(pgrep mbsync) +NOTMUCH=$(pgrep notmuch) + +if [ -n "$MBSYNC" -o -n "$NOTMUCH" ]; then + echo "Already running one instance of mbsync or notmuch. Exiting..." + exit 0 +fi + +# echo "Deleting messages tagged as *deleted*" +# notmuch search --format=text0 --output=files tag:deleted | xargs -0 --no-run-if-empty rm -v + +# sync mailbox with external servers +mbsync -Va +# apply tag:new to new mail +notmuch new +# new mail tagging pipeline +afew --tag --new +# signal waybar indicator update +echo "refresh" > "$PIPE" +# generate new ranked addressbook +maildir-rank-addr