diff --git a/Makefile b/Makefile index 569cd35..b84dff1 100644 --- a/Makefile +++ b/Makefile @@ -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 mkdir -p $(DESTDIR)$(MANPREFIX)/man1 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 \ sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ @@ -35,6 +36,6 @@ install: uninstall: 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 -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 + rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 .PHONY: install uninstall diff --git a/bin/mailsync b/bin/mailsync index e939b78..97cd224 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -30,6 +30,8 @@ export GPG_TTY="$(tty)" [ -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. case "$(uname)" in 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/"\ - -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) case 1 in $((newcount > 0)) ) notify "$acc" "$newcount" ;; @@ -87,4 +89,4 @@ wait notmuch new 2>/dev/null #Create a touch file that indicates the time of the last run of mailsync -touch "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" +touch "$lastrun" diff --git a/mailsync.1 b/mailsync.1 new file mode 100644 index 0000000..98d6a39 --- /dev/null +++ b/mailsync.1 @@ -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 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) diff --git a/mw.1 b/mw.1 index 4bdb383..2172f80 100644 --- a/mw.1 +++ b/mw.1 @@ -296,6 +296,7 @@ Written by Luke Smith originally in 2018. .SH LICENSE GPLv3 .SH SEE ALSO +.BR mailsync (1), .BR neomutt (1), .BR neomuttrc (1) .BR mbsync (1),