diff options
-rw-r--r-- | Makefile | 15 | ||||
-rwxr-xr-x | bin/mailsync | 6 | ||||
-rw-r--r-- | mailsync.1 | 60 | ||||
-rw-r--r-- | mw.1 | 1 | ||||
-rw-r--r-- | share/mailcap | 6 |
5 files changed, 78 insertions, 10 deletions
@@ -10,15 +10,18 @@ endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin + mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard cp -f bin/mw bin/mailsync bin/openfile $(DESTDIR)$(PREFIX)/bin/ - chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile + cp -f bin/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard + chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/switch.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard 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; \ @@ -26,11 +29,13 @@ install: rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \ sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \ rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap; \ + rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcapba; \ fi uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile - rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard - rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 + 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 $(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..e2e1153 --- /dev/null +++ b/mailsync.1 @@ -0,0 +1,60 @@ +.TH MAILSYNC 1 +.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 GPLv3 .SH SEE ALSO +.BR mailsync (1), .BR neomutt (1), .BR neomuttrc (1) .BR mbsync (1), diff --git a/share/mailcap b/share/mailcap index a49145f..0829b3b 100644 --- a/share/mailcap +++ b/share/mailcap @@ -1,9 +1,9 @@ text/plain; $EDITOR %s ; -text/html; openfile %s ; nametemplate=%s.html +text/html; /usr/local/lib/mutt-wizard/openfile %s ; nametemplate=%s.html text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; -image/*; openfile %s ; +image/*; /usr/local/lib/mutt-wizard/openfile %s ; video/*; setsid mpv --quiet %s &; copiousoutput audio/*; mpv %s ; -application/pdf; openfile %s ; +application/pdf; /usr/local/lib/mutt-wizard/openfile %s ; application/pgp-encrypted; gpg -d '%s'; copiousoutput; application/pgp-keys; gpg --import '%s'; copiousoutput; |