| @@ -1,10 +1,8 @@ | |||
| .POSIX: | |||
| OS = $(shell uname -s) | |||
| ifeq ($(OS), Darwin) | |||
| ifndef PREFIX | |||
| PREFIX = /usr/local | |||
| else | |||
| PREFIX = /usr | |||
| endif | |||
| MANPREFIX = $(PREFIX)/share/man | |||
| @@ -15,19 +13,26 @@ install: | |||
| chmod 755 $(DESTDIR)$(PREFIX)/$$script; \ | |||
| done | |||
| 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 | |||
| if [ "$(OS)" = "Darwin" ]; then \ | |||
| sed -iba 's/\/usr\//\/usr\/local\//' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ | |||
| rm $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ | |||
| fi | |||
| mkdir -p $(DESTDIR)$(MANPREFIX)/man1 | |||
| cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | |||
| chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.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; \ | |||
| sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \ | |||
| rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \ | |||
| sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \ | |||
| rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \ | |||
| fi | |||
| 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 | |||
| @@ -52,7 +52,7 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian | |||
| ### Optional | |||
| - `w3m` - view HTML email and images in neomutt. | |||
| - `lynx` - view HTML email in neomutt. | |||
| - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail, although the included `mailsync` script does this for you. | |||
| - `libnotify`/`libnotify-bin` - allows notifications when syncthing mail with `mailsync` | |||
| - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. | |||
| @@ -20,7 +20,7 @@ command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotif | |||
| if [ "$(uname)" = "Darwin" ]; then | |||
| notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} | |||
| else | |||
| notify() { notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} | |||
| notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} | |||
| fi | |||
| # Check account for new mail. Notify if there is new content. | |||
| @@ -35,7 +35,7 @@ syncandnotify() { | |||
| # Extract subject and sender from mail. | |||
| from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') | |||
| subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') | |||
| notify-send "📧$from:" "$subject" & | |||
| notify-send --app-name="mutt-wizard" "📧$from:" "$subject" & | |||
| done | |||
| fi | |||
| } | |||
| @@ -48,7 +48,7 @@ else | |||
| fi | |||
| echo " 🔃" > /tmp/imapsyncicon_"$USER" | |||
| pkill -RTMIN+12 i3blocks >/dev/null 2>&1 | |||
| pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1 | |||
| # Parallelize multiple accounts | |||
| for account in $accounts | |||
| @@ -58,7 +58,7 @@ done | |||
| wait | |||
| rm -f /tmp/imapsyncicon_"$USER" | |||
| pkill -RTMIN+12 i3blocks >/dev/null 2>&1 | |||
| pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1 | |||
| notmuch new 2>/dev/null | |||
| @@ -1,9 +1,9 @@ | |||
| #!/bin/bash | |||
| #!/usr/bin/env bash | |||
| #get image resolution | |||
| resolution=$(identify $1 | awk '{print $3}') | |||
| IFS='x' # x is set as delimiter | |||
| read -ra ADDR <<< "$resolution" | |||
| read -ra ADDR <<< "$resolution" | |||
| width=${ADDR[0]} | |||
| height=${ADDR[1]} | |||
| @@ -1,4 +1,4 @@ | |||
| #!/bin/sh | |||
| #!/usr/bin/env sh | |||
| command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" | |||
| [ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store" | |||
| [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && | |||
| @@ -8,11 +8,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" | |||
| } | |||
| ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit | |||
| case "$(uname)" in | |||
| Linux) prefix="/usr" ;; | |||
| *) prefix="/usr/local" ;; | |||
| esac | |||
| prefix="/usr/local" | |||
| muttdir="$HOME/.config/mutt" # Main mutt config location | |||
| accdir="$muttdir/accounts" # Directory for account settings | |||
| maildir="$HOME/.local/share/mail" # Location of mail storage | |||
| @@ -73,6 +69,7 @@ Patterns * !\"[Gmail]/All Mail\" | |||
| Create Both | |||
| SyncState * | |||
| MaxMessages $maxmes | |||
| ExpireUnread no | |||
| # End profile | |||
| " | |||
| @@ -242,7 +239,7 @@ finalize() { \ | |||
| trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g') | |||
| sed -ibu "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" | |||
| { echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$accdir/$idnum-$title.muttrc" | |||
| echo "mailboxes =$title ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc" | |||
| echo "mailboxes $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc" | |||
| printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" | |||
| sed -ibu "/# mw-autogenerated/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" | |||
| echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox | |||
| @@ -1,4 +1,4 @@ | |||
| #!/bin/sh | |||
| #!/usr/bin/env sh | |||
| # Helps open a file with xdg-open from mutt in a external program without weird side effects. | |||
| [ $(uname) = "Darwin" ] && opener="open" || opener="setsid xdg-open" | |||
| mkdir -p "/tmp/$USER-mutt-tmp" | |||
| @@ -60,10 +60,10 @@ will delete downloaded mail for for safety (and time)'s sake. If you want to del | |||
| .TP | |||
| .B Default settings | |||
| The mutt-wizard has many default settings that focus on making it aesthetically pleasing and supplying more vim-like bindings. These can be found in | |||
| .I /usr/share/mutt-wizard/mutt-wizard.muttrc | |||
| .I /usr/local/share/mutt-wizard/mutt-wizard.muttrc | |||
| and the default mailcap file can be found in | |||
| .I | |||
| /usr/share/mutt-wizard/mailcap. | |||
| /usr/local/share/mutt-wizard/mailcap. | |||
| Any of these settings can be overwritten in | |||
| .I ~/.config/mutt/muttrc, | |||
| but be mindful that your overriding binds should appear after the | |||
| @@ -73,7 +73,7 @@ file is sourced. | |||
| .TP | |||
| .B Detecting server settings | |||
| mutt-wizard has a repository of email services and their server information kept in | |||
| .I /usr/share/mutt-wizard/domains.csv | |||
| .I /usr/local/share/mutt-wizard/domains.csv | |||
| which is used to automatically configure email settings. | |||
| If your email provider is not found there, it will prompt you to input your email service's IMAP and SMTP server information which can usually be found by searching online. | |||
| @@ -1,4 +1,5 @@ | |||
| ADDRESS,IMAP,imap port,SMTP,smtp port | |||
| icloud.com,imap.mail.me.com,993,smtp.mail.me.com,587 | |||
| 420blaze.it,mail.cock.li,993,mail.cock.li,587 | |||
| 8chan.co,mail.cock.li,993,mail.cock.li,587 | |||
| aaathats3as.com,mail.cock.li,993,mail.cock.li,587 | |||
| @@ -278,3 +279,4 @@ yandex.ua,imap.yandex.com,993,smtp.yandex.com,587 | |||
| zoho.com,imap.zoho.com,993,smtp.zoho.com,465 | |||
| polito.it,mail.polito.it,993,mail.polito.it,465 | |||
| studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 | |||
| hs-mittweida.de,mail.hs-mittweida.de,993,mail.hs-mittweida.de,465 | |||
| @@ -1,6 +1,6 @@ | |||
| text/plain; $EDITOR %s ; | |||
| text/html; openfile %s ; nametemplate=%s.html | |||
| text/html; w3m -I %{charset} -T text/html; copiousoutput; | |||
| text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput; | |||
| image/*; muttimage %s ; copiousoutput | |||
| video/*; setsid mpv --quiet %s &; copiousoutput | |||
| application/pdf; openfile %s ; | |||
| @@ -3,7 +3,7 @@ | |||
| # mutt-wizard will have this file sourced from your muttrc. | |||
| # In the interest of seamless updating, do not edit this file. | |||
| # If you want to override any settings, set those in your muttrc. | |||
| set mailcap_path = /usr/share/mutt-wizard/mailcap | |||
| set mailcap_path = /usr/local/share/mutt-wizard/mailcap | |||
| set date_format="%y/%m/%d %I:%M%p" | |||
| set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" | |||
| set sort = 'reverse-date' | |||
| @@ -44,6 +44,7 @@ bind index U undelete-message | |||
| bind index L limit | |||
| bind index h noop | |||
| bind index l display-message | |||
| bind index <space> tag-entry | |||
| #bind browser h goto-parent | |||
| macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" | |||
| bind index,pager H view-raw-message | |||
| @@ -62,7 +63,7 @@ bind editor <Tab> complete-query | |||
| macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook" | |||
| macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" | |||
| macro index O "<shell-escape>mailsync -Va<enter>" "run mbsync to sync all mail" | |||
| macro index O "<shell-escape>mbsync -a<enter>" "run mbsync to sync all mail" | |||
| macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>read -p 'Enter a search term to find with notmuch: ' x; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern" | |||
| macro index A "<limit>all\n" "show all messages (undo limit)" | |||
| @@ -91,6 +92,11 @@ color index brightyellow black "~N" | |||
| color index_author brightred black "~N" | |||
| color index_subject brightcyan black "~N" | |||
| # Tagged mail is highlighted: | |||
| color index brightyellow blue "~T" | |||
| color index_author brightred blue "~T" | |||
| color index_subject brightcyan blue "~T" | |||
| # Other colors and aesthetic settings: | |||
| mono bold bold | |||
| mono underline underline | |||