@@ -20,7 +20,8 @@ install: | |||||
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/switch.muttrc | chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/switch.muttrc | ||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 | ||||
cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | ||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | |||||
cp -f mailsync.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 | |||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 | |||||
if [ "$(PREFIX)" ]; then \ | if [ "$(PREFIX)" ]; then \ | ||||
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ | sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ | ||||
rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ | rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ | ||||
@@ -35,6 +36,6 @@ install: | |||||
uninstall: | uninstall: | ||||
rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile | rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile | ||||
rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard $(DESTDIR)$(PREFIX)/lib/mutt-wizard | rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard $(DESTDIR)$(PREFIX)/lib/mutt-wizard | ||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 | |||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 | |||||
.PHONY: install uninstall | .PHONY: install uninstall |
@@ -30,6 +30,8 @@ export GPG_TTY="$(tty)" | |||||
[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" | [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" | ||||
lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" | |||||
# Settings are different for MacOS (Darwin) systems. | # Settings are different for MacOS (Darwin) systems. | ||||
case "$(uname)" in | case "$(uname)" in | ||||
Darwin) | Darwin) | ||||
@@ -60,7 +62,7 @@ syncandnotify() { | |||||
"$HOME/.local/share/mail/$acc/INBOX/cur/"\ | "$HOME/.local/share/mail/$acc/INBOX/cur/"\ | ||||
"$HOME/.local/share/mail/$acc/Inbox/cur/"\ | "$HOME/.local/share/mail/$acc/Inbox/cur/"\ | ||||
"$HOME/.local/share/mail/$acc/inbox/cur/"\ | "$HOME/.local/share/mail/$acc/inbox/cur/"\ | ||||
-type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) | |||||
-type f -newer "$lastrun" 2> /dev/null) | |||||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) | newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) | ||||
case 1 in | case 1 in | ||||
$((newcount > 0)) ) notify "$acc" "$newcount" ;; | $((newcount > 0)) ) notify "$acc" "$newcount" ;; | ||||
@@ -87,4 +89,4 @@ wait | |||||
notmuch new 2>/dev/null | notmuch new 2>/dev/null | ||||
#Create a touch file that indicates the time of the last run of mailsync | #Create a touch file that indicates the time of the last run of mailsync | ||||
touch "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" | |||||
touch "$lastrun" |
@@ -0,0 +1,60 @@ | |||||
.TH MW 1 mailsync | |||||
.SH NAME | |||||
mailsync \- sync mail accounts set up with | |||||
.B mw. | |||||
.SH SYNOPSIS | |||||
.B mailsync | |||||
[ | |||||
.I OPTIONS | |||||
]... [ | |||||
.I ACCOUNTS | |||||
] | |||||
.SH DESCRIPTION | |||||
.B mailsync | |||||
syncs the mail of all accounts set up with | |||||
.B | |||||
mw, | |||||
or if account names are given, syncs only those accounts. | |||||
.B | |||||
mailsync | |||||
can also pass on options to | |||||
.B | |||||
mbsync, | |||||
which it uses to sync mail. | |||||
.B | |||||
mailsync | |||||
is a wrapper for | |||||
.B mbsync, | |||||
but also automatically reindexes new mail with | |||||
.B notmuch, | |||||
gives notifications if new mail is found and can also be set as a cronjob to sync and index mail quietly in the background. | |||||
.SH COMMANDS | |||||
.TP | |||||
.B mailsync | |||||
sync all mail accounts and notify user if there is new mail | |||||
.TP | |||||
.B mailsync account@example.org | |||||
only sync the | |||||
.B account@example.org | |||||
account. | |||||
.TP | |||||
.B | |||||
-* | |||||
See the | |||||
.B | |||||
mbsync | |||||
manual for aditional options that can be used. | |||||
.SH AUTHORS | |||||
Written by Luke Smith <luke@lukesmith.xyz> originally in 2018. | |||||
.SH LICENSE | |||||
GPLv3 | |||||
.SH SEE ALSO | |||||
.BR mw (1), | |||||
.BR neomutt (1), | |||||
.BR neomuttrc (1) | |||||
.BR mbsync (1), | |||||
.BR mpop (1), | |||||
.BR msmtp (1), | |||||
.BR notmuch (1), | |||||
.BR abook (1) |
@@ -296,6 +296,7 @@ Written by Luke Smith <luke@lukesmith.xyz> originally in 2018. | |||||
.SH LICENSE | .SH LICENSE | ||||
GPLv3 | GPLv3 | ||||
.SH SEE ALSO | .SH SEE ALSO | ||||
.BR mailsync (1), | |||||
.BR neomutt (1), | .BR neomutt (1), | ||||
.BR neomuttrc (1) | .BR neomuttrc (1) | ||||
.BR mbsync (1), | .BR mbsync (1), | ||||