From 2cd21c2db29e0a79a8fb7c667af6bf5b1a962da0 Mon Sep 17 00:00:00 2001 From: "A. Tammy" Date: Thu, 13 Aug 2020 16:02:34 -0400 Subject: add check for MANPREFIX (#510) --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 70f780d..1d8d362 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,9 @@ OS = $(shell uname -s) ifndef PREFIX PREFIX = /usr/local endif -MANPREFIX = $(PREFIX)/share/man +ifndef MANPREFIX + MANPREFIX = $(PREFIX)/share/man +endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin -- cgit v1.2.3 From 22acbeb3e5146ae9d04398169b4fb4aa57587804 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jan 2021 13:32:41 -0500 Subject: makefile fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1d8d362..7b78355 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ install: uninstall: for script in bin/*; do \ - rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \ + rm -f $(DESTDIR)$(PREFIX)/$$script; \ done rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 -- cgit v1.2.3 From f7c317169f79497f5910f21dfeb181d6616a5be3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 4 May 2021 10:45:42 -0400 Subject: close #705 and avoid loops --- Makefile | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7b78355..5cd5bf2 100644 --- a/Makefile +++ b/Makefile @@ -10,16 +10,12 @@ endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin - for script in bin/*; do \ - cp -f $$script $(DESTDIR)$(PREFIX)/bin/; \ - chmod 755 $(DESTDIR)$(PREFIX)/$$script; \ - done + 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 mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard - for shared in share/*; do \ - cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \ - chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/$$(basename $(notdir $$shared)); \ - done + cp -f share/mailcap share/domains.csv share/mutt-wizard.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 mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 @@ -33,9 +29,7 @@ install: fi uninstall: - for script in bin/*; do \ - rm -f $(DESTDIR)$(PREFIX)/$$script; \ - done + 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 -- cgit v1.2.3 From e8458ace20a1e553df1c6249b9ef27234dd2aafd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 13:06:17 -0400 Subject: fix #691, fix #689, fix #690 --- Makefile | 4 ++-- bin/mw | 10 +--------- share/domains.csv | 2 +- share/unbind.muttrc | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 share/unbind.muttrc (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5cd5bf2..64036d0 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ install: chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/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 $(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 + cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/unbind.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/unbind.muttrc mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 diff --git a/bin/mw b/bin/mw index e63fff2..2b9a41a 100755 --- a/bin/mw +++ b/bin/mw @@ -101,16 +101,8 @@ set header_cache = $cachedir/$fulladdr/headers set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir set hostname = \"$hostname\" +source $muttshare/unbind.muttrc $extra - -bind index,pager gg noop -bind index,pager g noop -bind index,pager M noop -bind index,pager C noop -bind index gg first-entry -unmailboxes * -unalternates * -unset signature $synccmd " > "$accdir/$idnum-$fulladdr.muttrc" diff --git a/share/domains.csv b/share/domains.csv index 672a1c6..e307b22 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -50,7 +50,7 @@ canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 cash4u.com,imap.mail.com,993,smtp.mail.com,587 -cedars.xyz,imap.cedars.xyz,993,smtp.cedars.xyz,465 +cedars.xyz,mail.cedars.xyz,993,mail.cedars.xyz,465 ceng.metu.edu.tr,imap.ceng.metu.edu.tr,993,mailhost.ceng.metu.edu.tr,587 cheerful.com,imap.mail.com,993,smtp.mail.com,587 chef.net,imap.mail.com,993,smtp.mail.com,587 diff --git a/share/unbind.muttrc b/share/unbind.muttrc new file mode 100644 index 0000000..330d823 --- /dev/null +++ b/share/unbind.muttrc @@ -0,0 +1,37 @@ +# vim: filetype=neomuttrc + +# This is an embarrassing and hacky file that unbinds a bunch of binds between +# switching accounts. It is called each time an account is changed. + +bind index,pager gi noop +bind index,pager gs noop +bind index,pager gd noop +bind index,pager ga noop +bind index,pager gS noop +bind index,pager gj noop +bind index,pager gt noop +bind index,pager Mi noop +bind index,pager Ms noop +bind index,pager Md noop +bind index,pager Ma noop +bind index,pager MS noop +bind index,pager Mj noop +bind index,pager Mt noop +bind index,pager Ci noop +bind index,pager Cs noop +bind index,pager Cd noop +bind index,pager Ca noop +bind index,pager CS noop +bind index,pager Cj noop +bind index,pager Ct noop +bind index,pager gg noop +bind index,pager g noop +bind index,pager M noop +bind index,pager C noop +unset hostname +unmy_hdr Organization +unmailboxes * +unalternates * +unset signature + +bind index gg first-entry -- cgit v1.2.3 From bd0075898ae441bb5e59f83d8b34df68b55aafb3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 22:18:54 -0400 Subject: hardcode mailbox names. don't remake shortcuts. --- Makefile | 4 ++-- bin/mailsync | 2 +- bin/mw | 34 +++++++--------------------------- share/mutt-wizard.muttrc | 23 +++++++++++++++++++++++ share/switch.muttrc | 10 ++++++++++ share/unbind.muttrc | 37 ------------------------------------- 6 files changed, 43 insertions(+), 67 deletions(-) create mode 100644 share/switch.muttrc delete mode 100644 share/unbind.muttrc (limited to 'Makefile') diff --git a/Makefile b/Makefile index 64036d0..03e2df1 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ install: chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/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/unbind.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/unbind.muttrc + 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 diff --git a/bin/mailsync b/bin/mailsync index 9490458..36f963b 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -36,7 +36,7 @@ case "$(uname)" in ;; *) case "$(readlink -f /sbin/init)" in - *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; + *systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; esac # remember if a display server is running since `ps` doesn't always contain a display pgrepoutput="$(pgrep -a X\(org\|wayland\))" diff --git a/bin/mw b/bin/mw index 01bf86b..16df7d3 100755 --- a/bin/mw +++ b/bin/mw @@ -101,7 +101,11 @@ set header_cache = $cachedir/$fulladdr/headers set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir set hostname = \"$hostname\" -source $muttshare/unbind.muttrc +source $muttshare/switch.muttrc +set spoolfile = "+INBOX" +set postponed = "+Drafts" +set trash = "+Trash" +set record = "+Sent" $extra $synccmd " > "$accdir/$fulladdr.muttrc" @@ -135,7 +139,6 @@ set ssl_force_tls = yes" esac prepmsmtp prepmutt - prepnotmuch # Create a notmuch config file if not present already. } @@ -211,14 +214,6 @@ createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr" getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 pass insert -f "$fulladdr" && break; done ;} -formatShortcut() { toappend="$toappend -macro index,pager g$1 \"=$3\" \"go to $2\" -macro index,pager M$1 \";=$3\" \"move mail to $2\" -macro index,pager C$1 \";=$3\" \"copy mail to $2\"" ;} - -setBox() { toappend="$toappend -set $1 = \"+$2\"" ;} - getboxes() { if [ -n "${force+x}" ] ; then mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" else @@ -232,20 +227,6 @@ getboxes() { if [ -n "${force+x}" ] ; then [ $idnum -eq $x ] || break done toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" - IFS=' -' - for x in $mailboxes; do - case "$x" in - *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; - *[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;; - *[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;; - *[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;; - *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; - *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; - *[Ii][Nn][Bb][Oo][Xx]) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;; - esac - done - unset IFS } finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" @@ -257,7 +238,7 @@ finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" prepnotmuch() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 - nmbasic="[database] + echo "[database] path=$maildir [user] name=$realname @@ -270,8 +251,7 @@ exclude_tags=deleted;spam; [maildir] synchronize_flags=true [crypto] -gpg_path=$GPG" - echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} +gpg_path=$GPG" > "$NOTMUCH_CONFIG" ;} togglecron() { cron="$(mktemp)" crontab -l > "$cron" diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 2cb7c8e..a12a77e 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -27,11 +27,15 @@ auto_view text/html # automatically show html (mailcap uses lynx) auto_view application/pgp-encrypted #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. alternative_order text/plain text/enriched text/html + bind index,pager i noop bind index,pager g noop bind index \Cf noop +bind index,pager M noop +bind index,pager C noop # General rebindings +bind index gg first-entry bind index j next-entry bind index k previous-entry bind attach view-mailcap @@ -65,6 +69,25 @@ bind pager \031 previous-line # Mouse wheel bind pager \005 next-line # Mouse wheel bind editor complete-query +macro index,pager gi "=INBOX" "go to inbox" +macro index,pager Mi ";=INBOX" "move mail to inbox" +macro index,pager Ci ";=INBOX" "copy mail to inbox" +macro index,pager gd "=Drafts" "go to drafts" +macro index,pager Md ";=Drafts" "move mail to drafts" +macro index,pager Cd ";=Drafts" "copy mail to drafts" +macro index,pager gj "=Junk" "go to junk" +macro index,pager Mj ";=Junk" "move mail to junk" +macro index,pager Cj ";=Junk" "copy mail to junk" +macro index,pager gt "=Trash" "go to trash" +macro index,pager Mt ";=Trash" "move mail to trash" +macro index,pager Ct ";=Trash" "copy mail to trash" +macro index,pager gs "=Sent" "go to sent" +macro index,pager Ms ";=Sent" "move mail to sent" +macro index,pager Cs ";=Sent" "copy mail to sent" +macro index,pager ga "=Archive" "go to archive" +macro index,pager Ma ";=Archive" "move mail to archive" +macro index,pager Ca ";=Archive" "copy mail to archive" + #set crypt_autosign = yes #set crypt_opportunistic_encrypt = yes #set pgp_self_encrypt = yes diff --git a/share/switch.muttrc b/share/switch.muttrc new file mode 100644 index 0000000..c808c99 --- /dev/null +++ b/share/switch.muttrc @@ -0,0 +1,10 @@ +# vim: filetype=neomuttrc + +# This is an embarrassing and hacky file that unbinds a bunch of binds between +# switching accounts. It is called each time an account is changed. + +unset hostname +unmy_hdr Organization +unmailboxes * +unalternates * +unset signature diff --git a/share/unbind.muttrc b/share/unbind.muttrc deleted file mode 100644 index 330d823..0000000 --- a/share/unbind.muttrc +++ /dev/null @@ -1,37 +0,0 @@ -# vim: filetype=neomuttrc - -# This is an embarrassing and hacky file that unbinds a bunch of binds between -# switching accounts. It is called each time an account is changed. - -bind index,pager gi noop -bind index,pager gs noop -bind index,pager gd noop -bind index,pager ga noop -bind index,pager gS noop -bind index,pager gj noop -bind index,pager gt noop -bind index,pager Mi noop -bind index,pager Ms noop -bind index,pager Md noop -bind index,pager Ma noop -bind index,pager MS noop -bind index,pager Mj noop -bind index,pager Mt noop -bind index,pager Ci noop -bind index,pager Cs noop -bind index,pager Cd noop -bind index,pager Ca noop -bind index,pager CS noop -bind index,pager Cj noop -bind index,pager Ct noop -bind index,pager gg noop -bind index,pager g noop -bind index,pager M noop -bind index,pager C noop -unset hostname -unmy_hdr Organization -unmailboxes * -unalternates * -unset signature - -bind index gg first-entry -- cgit v1.2.3 From 480fc82f9b7f222c5fdf5da43e22a1518899aa8f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 29 Apr 2022 14:49:11 -0400 Subject: openfile moved to lib, not for sole running --- Makefile | 10 +++++++--- share/mailcap | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 03e2df1..569cd35 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,10 @@ 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 @@ -26,11 +28,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)$(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 .PHONY: install uninstall 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; -- cgit v1.2.3 From 5ae4758790603dc28a3a1bf8c21a991850b892ab Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 29 Apr 2022 15:11:16 -0400 Subject: mailsync manual per debian requirements --- Makefile | 5 +++-- bin/mailsync | 6 ++++-- mailsync.1 | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mw.1 | 1 + 4 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 mailsync.1 (limited to 'Makefile') 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), -- cgit v1.2.3 From 4911a7eff3471a144f7ea590bf6936cbd51d5689 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Apr 2022 09:57:57 -0400 Subject: openfile to lib --- Makefile | 4 ++-- bin/openfile | 10 ---------- lib/openfile | 10 ++++++++++ 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100755 bin/openfile create mode 100755 lib/openfile (limited to 'Makefile') diff --git a/Makefile b/Makefile index b84dff1..0b610be 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ 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/ - cp -f bin/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard + cp -f bin/mw bin/mailsync $(DESTDIR)$(PREFIX)/bin/ + cp -f lib/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 diff --git a/bin/openfile b/bin/openfile deleted file mode 100755 index cf3c6c3..0000000 --- a/bin/openfile +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Helps open a file with xdg-open from mutt in a external program without weird side effects. -tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" -file="$tempdir/$(basename "$1")" -[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" -mkdir -p "$tempdir" -cp -f "$1" "$file" -$opener "$file" >/dev/null 2>&1 -find "${tempdir:?}" -mtime +1 -type f -delete diff --git a/lib/openfile b/lib/openfile new file mode 100755 index 0000000..0f60b10 --- /dev/null +++ b/lib/openfile @@ -0,0 +1,10 @@ +#!/bin/sh + +# Helps open a file with xdg-open from mutt in a external program without weird side effects. +tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" +file="$tempdir/${1##*/}" +[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" +mkdir -p "$tempdir" +cp -f "$1" "$file" +$opener "$file" >/dev/null 2>&1 +find "${tempdir:?}" -mtime +1 -type f -delete -- cgit v1.2.3