dotfiles/mail/aerc/mail-sync.sh.example
Adam Cooper 60793326fb Various changes
- [X11] Fix backspace behavior
- [bin] Remove 'insecure' flag from curl commands in w3m-wallabagger script
- [aerc] Update column formatting
- [aerc] Update mailinglist tag
- [newsboat] Add macro to launch mpv for podcasts
- [vim] Tweaks for Python & HTML/CSS
- [xmobar] Update xmobarrc
- [xmonad] Replace xterm with alacritty
- [zsh] gomphotherium
2023-05-17 02:17:02 -04:00

38 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
OFFLINEIMAP=$(pgrep offlineimap)
NOTMUCH=$(pgrep notmuch)
if [ -n "$OFFLINEIMAP" ] || [ -n "$NOTMUCH" ]; then
echo "Already running one instance of offlineimap 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
offlineimap -o
notmuch new
# retag all "new" messages "inbox" and "unread"
notmuch tag +inbox +unread -new -- tag:new
# mailing lists
notmuch tag +mailinglist -- to:xmonad@haskell.org
notmuch tag +mailinglist -- to:guile-user@gnu.org
notmuch tag +mailinglist -- to:zsh-users@zsh.org
notmuch tag +mailinglist -- to:qutebrowser@lists.qutebrowser.org
notmuch tag +mailinglist -- to:~rjarry/aerc-discuss@lists.sr.ht
notmuch tag +mailinglist -- from:outgoing@sr.ht
# TODO: Confirm that we need to do this
# move tagged items across folders and retag
notmuch search --output=files tag:trash and not folder:Trash | xargs mv -t /home/adam/Maildir/Trash/cur/
notmuch tag +trash -inbox -sent -archive -junk -drafts -- folder:Trash and not tag:trash
# move unimportant institutional messages to the trash after a couple of days
notmuch tag +trash -inbox -- date:..2d and tag:mailinglist
notmuch tag +trash -inbox -- date:..2d and from:@facebookmail.com
notmuch tag +trash -inbox -- date:..2d and from:noreply@twitch.tv
notmuch tag +trash -inbox -- date:..2d and from:messages-noreply@linkedin.com