mutt-wizard

fork of Luke Smiths mutt-wizard
git clone git://git.jakekoroman.com/mutt-wizard
Log | Files | Refs | README | LICENSE

commit 70257daa83fee7a9ac0563d9a2d86991d0031dd8
parent 5d72b5da981f8c71b7fe47997b7fd309e6e861cd
Author: luukvbaal <31730729+luukvbaal@users.noreply.github.com>
Date:   Thu, 30 May 2019 16:54:38 +0200

Merge branch 'master' into patch-1
Diffstat:
MREADME.md | 2+-
Mbin/mailsync | 2+-
Mbin/muttimage | 12+++++++++---
Mbin/mw | 20+++++++++++++-------
Mbin/openfile | 5++---
Mshare/domains.csv | 17+++++++++++++++--
6 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/README.md b/README.md @@ -53,7 +53,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. -- `[notmuch](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. +- `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. - A cron manager - if you want to enable the auto-sync feature. diff --git a/bin/mailsync b/bin/mailsync @@ -40,7 +40,7 @@ syncandnotify() { fi } -# Run +# Sync accounts passed as argument or all. if [ "$#" -eq "0" ]; then accounts="$(ls "$HOME/.local/share/mail")" else diff --git a/bin/muttimage b/bin/muttimage @@ -1,5 +1,11 @@ #!/bin/bash -height=$(stty size | awk 'BEGIN {FS = " "} {print $1;}') -width=$(stty size | awk 'BEGIN {FS = " "} {print $2;}') + +#get image resolution +resolution=$(identify $1 | awk '{print $3}') +IFS='x' # x is set as delimiter +read -ra ADDR <<< "$resolution" +width=${ADDR[0]} +height=${ADDR[1]} + ### Display Image / offset with mutt bar -echo -e "2;3;\n0;1;210;20;$((width*7-250));$((height*14-100));0;0;0;0;$1\n4;\n3;" | /usr/lib/w3m/w3mimgdisplay & +echo -e "2;3;\n0;1;0;42;$((width));$((height));0;0;0;0;$1\n4;\n3;" | /usr/lib/w3m/w3mimgdisplay & diff --git a/bin/mw b/bin/mw @@ -1,13 +1,17 @@ #!/bin/sh command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" -! "$GPG" --list-secret-keys $(cat "$HOME/.password-store/.gpg-id") >/dev/null 2>&1 && printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init <yourgpgemail>\`.\\nIf you don't have a GPG public private key pair, run \`$GPG --full-gen-key\` first.\\n" && exit +[ -r "$HOME/.password-store/.gpg-id" ] && + "$GPG" --list-secret-keys $(cat "$HOME/.password-store/.gpg-id") >/dev/null 2>&1 || { + printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init <yourgpgemail>\`.\\nIf you don't have a GPG public private key pair, run \`$GPG --full-gen-key\` first.\\n" + exit + } ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit -if [[ "$OSTYPE" == "darwin"* ]]; then - prefix="/usr/local" -else - prefix="/usr" -fi +case "$(uname)" in + Linux) prefix="/usr" ;; + *) prefix="/usr/local" ;; +esac + muttdir="$HOME/.config/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="$HOME/.local/share/mail" # Location of mail storage @@ -212,7 +216,7 @@ tryconnect() { mkdir -p "$maildir/$title" fi ;} finalize() { \ - boxes="$(find "$maildir/$title/" -mindepth 1 -maxdepth 1 | sed "s/^.*\//=/")" + boxes="$(find "$maildir/$title/" -mindepth 1 -maxdepth 1 | sed "s/\ /\\\ /g;s/^.*\//=/")" [ -z "$boxes" ] && printf "\033[31mNo local mailboxes have been detected for %s.\033[0m\\nThis means that mbsync has not been successfully run.\\nRun mbsync, and if it has an error, be sure to check your password and server settings manually if needbe.\\n" "$title" && return printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" spoolfile=$(echo "$boxes" | grep -i -m 1 inbox | sed 's/=/+/g') @@ -309,6 +313,8 @@ synchronize_flags=true gpg_path=$GPG" echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} +trap 'echo -e "\033[0m\n"' INT + case "$1" in ls) list ;; add) asktype && askinfo && tryconnect && finalize || delete ;; diff --git a/bin/openfile b/bin/openfile @@ -1,9 +1,8 @@ #!/bin/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" -base=$(basename "$1") -ext="${base##*.}" -file=$(mktemp -u --suffix=".$ext") +mkdir -p "/tmp/$USER-mutt-tmp" +file="/tmp/$USER-mutt-tmp/$(basename "$1")" rm -f "$file" cp "$1" "$file" $opener "$file" >/dev/null 2>&1 & diff --git a/share/domains.csv b/share/domains.csv @@ -7,6 +7,7 @@ activist.com,imap.mail.com,993,smtp.mail.com,587 adexec.com,imap.mail.com,993,smtp.mail.com,587 airmail.cc,mail.cock.li,993,mail.cock.li,587 allergist.com,imap.mail.com,993,smtp.mail.com,587 +alumni.bits-pilani.ac.in,imap.gmail.com,993,smtp.gmail.com,465 alumni.com,imap.mail.com,993,smtp.mail.com,587 alumnidirector.com,imap.mail.com,993,smtp.mail.com,587 alunos.utfpr.edu.br,imap.gmail.com,993,smtp.gmail.com,587 @@ -41,6 +42,8 @@ chemist.com,imap.mail.com,993,smtp.mail.com,587 chrissx.ga,chrissx.ga,993,chrissx.ga,25 clerk.com,imap.mail.com,993,smtp.mail.com,587 clubmember.org,imap.mail.com,993,smtp.mail.com,587 +cmail.carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 cocaine.ninja,mail.cock.li,993,mail.cock.li,587 cock.email,mail.cock.li,993,mail.cock.li,587 cock.li,mail.cock.li,993,mail.cock.li,587 @@ -56,6 +59,7 @@ counsellor.com,imap.mail.com,993,smtp.mail.com,587 cryptolab.net,mail.autistici.org,993,smtp.autistici.org,465 cumallover.me,mail.cock.li,993,mail.cock.li,587 cyberservices.com,imap.mail.com,993,smtp.mail.com,587 +datentopf.org,mail.datentopf.org,993,mail.datentopf.org,587 deliveryman.com,imap.mail.com,993,smtp.mail.com,587 dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 @@ -66,8 +70,10 @@ dr.com,imap.mail.com,993,smtp.mail.com,587 duke.edu,outlook.office365.com,993,smtp.office365.com,587 email.arizona.edu,imap.gmail.com,993,smtp.gmail.com,587 email.com,imap.mail.com,993,smtp.mail.com,587 +eneco.com,outlook.office365.com,993,smtp.office365.com,587 engineer.com,imap.mail.com,993,smtp.mail.com,587 erciyes.edu.tr,posta.erciyes.edu.tr,993,smtp.erciyes.edu.tr,587 +ethancoe.com,mail.privateemail.com,993,mail.privateemail.com,465 europe.com,imap.mail.com,993,smtp.mail.com,587 fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465 fastmail.fm,imap.fastmail.com,993,smtp.fastmail.com,465 @@ -99,6 +105,7 @@ hotmail.fr,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 iname.com,imap.mail.com,993,smtp.mail.com,587 +inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 insiberia.net,mail.autistici.org,993,smtp.autistici.org,465 insicuri.net,mail.autistici.org,993,smtp.autistici.org,465 interia.eu,poczta.interia.pl,993,poczta.interia.pl,465 @@ -113,7 +120,7 @@ live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 logorroici.org,mail.autistici.org,993,smtp.autistici.org,465 loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 -lukesmith.xyz,imap.yandex.com,993,smtp.yandex.com,587 +lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 mail.com,imap.mail.com,993,smtp.mail.com,587 mail.ru,imap.mail.ru,993,smtp.mail.ru,465 mailbox.org,imap.mailbox.org,993,smtps.mailbox.org,465 @@ -134,7 +141,7 @@ one.com,imap.one.com,993,send.one.com,465 onenetbeyond.org,mail.autistici.org,993,smtp.autistici.org,465 onet.com.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 onet.eu,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 -onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 +onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,587 online.de,imap.1und1.de,993,smtp.1und1.de,465 op.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 opoczta.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 @@ -146,6 +153,8 @@ paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 pm.me,127.0.0.1,1143,127.0.0.1,1025 poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 +polimi.it,outlook.office365.com,993,smtp.office365.com,587 +mail.polimi.it,outlook.office365.com,993,smtp.office365.com,587 post.com,imap.mail.com,993,smtp.mail.com,587 posteo.de,posteo.de,993,posteo.de,587 posteo.net,posteo.de,993,posteo.de,587 @@ -158,11 +167,13 @@ redchan.it,mail.cock.li,993,mail.cock.li,587 runbox.com,mail.runbox.com,993,mail.runbox.com,587 rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 +smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 spoko.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 stronzi.org,mail.autistici.org,993,smtp.autistici.org,465 stud.tu-darmstadt.de,imap.stud.tu-darmstadt.de,993,smtp.tu-darmstadt.de,465 stud.uis.no,outlook.office365.com,993,smtp.office365.com,587 +student.rmit.edu.au,outlook.office365.com,993,smtp.office365.com,587 students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 studserv.uni-leipzig.de,studserv.uni-leipzig.de,993,studserv.uni-leipzig.de,25 subvertising.org,mail.autistici.org,993,smtp.autistici.org,465 @@ -179,8 +190,10 @@ uach.mx,imap.gmail.com,993,smtp.gmail.com,587 uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587 uqtr.ca,outlook.office365.com,993,smtp.office365.com,587 usa.com,imap.mail.com,993,smtp.mail.com,587 +uw.edu,imap.gmail.com,993,smtp.gmail.com,465 uymail.com,imap.mail.com,993,smtp.mail.com,587 vip.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 +vivaldi.net,imap.vivaldi.net,993,smtp.vivaldi.net,587 vp.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 vt.edu,imap.gmail.com,993,smtp.gmail.com,587 waifu.club,mail.cock.li,993,mail.cock.li,587