diff --git a/README.md b/README.md index a25d70b..1b72ef8 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,6 @@ sudo make install User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). -*NOTE:* If you have used an older version of mutt-wizard, especially when it used to use `offlineimap`, you need to remove your old configs. Back anything up that's important and run: - -``` -rm -rf ~/.config/mutt ~/.msmtprc ~/.config/msmtp ~/.offlineimap ~/.offlineimaprc ~/.config/offlineimap ~/.mbsyncrc -``` - The mutt-wizard is run with the command `mw`. It also installs the `mailsync` command. Once everything is setup, you'll use `neomutt` to access your mail. - `mw add` -- add a new email account diff --git a/bin/mailsync b/bin/mailsync index 2d82690..326279c 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -1,11 +1,6 @@ -#!/usr/bin/env sh -# Sync mail and give notification if there is new mail. +#!/bin/sh -export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus -export DBUS_SESSION_BUS_ADDRESS -export DISPLAY=:0.0 -[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" +# Sync mail and give notification if there is new mail. # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} @@ -16,6 +11,14 @@ pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; exit ;} command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script." +# Required to display notifications if run as a cronjob: +DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +export DISPLAY=:0.0 + +# For individual configurations: +[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" +pgrep i3blocks >/dev/null && STATUSBAR="i3blocks" || STATUSBAR="dwmblocks" + # Settings are different for MacOS (Darwin) systems. if [ "$(uname)" = "Darwin" ]; then notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} diff --git a/bin/muttimage b/bin/muttimage deleted file mode 100755 index a846bea..0000000 --- a/bin/muttimage +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -#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;0;42;$((width));$((height));0;0;0;0;$1\n4;\n3;" | /usr/lib/w3m/w3mimgdisplay & diff --git a/bin/mw b/bin/mw index eaafd7c..9d712c9 100755 --- a/bin/mw +++ b/bin/mw @@ -1,4 +1,5 @@ -#!/usr/bin/env sh +#!/bin/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" ] && @@ -55,6 +56,7 @@ PassCmd \"pass mutt-wizard-$title\" SSLType $ssltype CertificateFile $sslcertmbsync + MaildirStore $title-local Subfolders Verbatim Path ~/.local/share/mail/$title/ @@ -233,7 +235,7 @@ tryconnect() { mkdir -p "$maildir/$title" fi ;} finalize() { \ - boxes="$(find "$maildir/$title/" -mindepth 1 -maxdepth 1 | sed "s/\ /\\\ /g;s/^.*\//=/")" + boxes="$(find "$maildir/$title/" -mindepth 1 -type d | sed "s/\ /\\\ /g;s/^.*\//=/;/=\(cur\|new\|tmp\)$/d")" [ -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') @@ -257,8 +259,8 @@ finalize() { \ return 0 } -confirm() { printf "Do you want to %s? [y/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^y$\|^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 - printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^y$\|^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 +confirm() { printf "Do you want to %s? [yes/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 + printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 return 0 ;} pick() { printf "Select an accounts to %s:\\n" "$1" @@ -292,7 +294,7 @@ choosecron() { ! pgrep cron >/dev/null && echo "No cron manager running. Install read -r minnum printf "\033[0m" done - (crontab -l; echo "*/$minnum * * * * export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus; export DISPLAY=:0; . \$HOME/.profile; $(type mailsync | cut -d' ' -f3)") | crontab - && + (crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3)") | crontab - && echo "Cronjob added. Mail will sync every $minnum minutes. Be sure you have your cron manager running." fi ;} diff --git a/bin/openfile b/bin/openfile index b16483b..c0e2e9c 100755 --- a/bin/openfile +++ b/bin/openfile @@ -1,4 +1,5 @@ -#!/usr/bin/env sh +#!/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" mkdir -p "/tmp/$USER-mutt-tmp" diff --git a/share/domains.csv b/share/domains.csv index 0679a67..712f2a9 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,5 +1,4 @@ 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 @@ -144,9 +143,12 @@ hotmail.rs,outlook.office365.com,993,smtp.office365.com,587 hotmail.se,outlook.office365.com,993,smtp.office365.com,587 hotmail.sg,outlook.office365.com,993,smtp.office365.com,587 hotmail.sk,outlook.office365.com,993,smtp.office365.com,587 -humbug.pw,mail.humbug.pw,993,mail.humbug.pw,587 +hs-mittweida.de,mail.hs-mittweida.de,993,mail.hs-mittweida.de,465 +humbug.pw,imap.migadu.com,993,smtp.migadu.com,587 hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 +icloud.com,imap.mail.me.com,993,smtp.mail.me.com,587 illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 +in.tum.de,mail.in.tum.de,993,mail.in.tum.de,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 infomaniak.com,imap.infomaniak.com,993,imap.infomaniak.com,587 @@ -156,6 +158,7 @@ interactio.io,imap.gmail.com,993,smtp.gmail.com,587 interia.eu,poczta.interia.pl,993,poczta.interia.pl,465 interia.pl,poczta.interia.pl,993,poczta.interia.pl,465 inventati.org,mail.autistici.org,993,smtp.autistici.org,465 +ionos.de,imap.ionos.de,993,smtp.ionos.de,587 itu.dk,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 kipras.org,mail.kipras.org,993,mail.kipras.org,587 krutt.org,mail.autistici.org,993,smtp.autistici.org,465 @@ -182,6 +185,7 @@ muny.us,mail.muny.us,993,mail.muny.us,465 myself.com,imap.mail.com,993,smtp.mail.com,587 narod.ru,imap.yandex.com,993,smtp.yandex.com,587 national.shitposting.agency,mail.cock.li,993,mail.cock.li,587 +ncsu.edu,imap.gmail.com,993,smtp.gmail.com,587 netcourrier.com,mail.netcourrier.com,993,mail.netcourrier.com,465 nigge.rs,mail.cock.li,993,mail.cock.li,587 nuke.africa,mail.cock.li,993,mail.cock.li,587 @@ -206,6 +210,8 @@ 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 +polito.it,mail.polito.it,993,mail.polito.it,465 +polito.it,mail.polito.it,993,mail.polito.it,465 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 @@ -231,6 +237,8 @@ student.rmit.edu.au,outlook.office365.com,993,smtp.office365.com,587 student.tuwien.ac.at,mail.student.tuwien.ac.at,993,mail.student.tuwien.ac.at,587 studenti.unipi.it,outlook.office365.com,995,smtp.office365.com,587 students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 +studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 +studio.unibo.it,outlook.office365.com,993,smtp.office365.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 t-online.de,secureimap.t-online.de,993,securesmtp.t-online.de,465 @@ -244,10 +252,13 @@ tlu.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 tquad.ai,imap.mail.eu-west-1.awsapps.com,993,smtp.mail.eu-west-1.awsapps.com,465 tu-harburg.de,mail.tu-harburg.de,993,mail.tu-harburg.de,587 tuhh.de,mail.tu-harburg.de,993,mail.tu-harburg.de,587 +tum.de,xmail.mwn.de,993,postout.lrz.de,587 txstate.edu,outlook.office365.com,993,smtp.office365.com,587 ua.pt,outlook.office365.com,993,mail.ua.pt,25 uach.mx,imap.gmail.com,993,smtp.gmail.com,587 +ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 +unitybox.de,mail.unity-mail.de,993,mail.unity-mail.de,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 @@ -278,9 +289,6 @@ yandex.kz,imap.yandex.com,993,smtp.yandex.com,587 yandex.net,imap.yandex.com,993,smtp.yandex.com,587 yandex.ru,imap.yandex.com,993,smtp.yandex.com,587 yandex.ua,imap.yandex.com,993,smtp.yandex.com,587 +zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,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 -in.tum.de,mail.in.tum.de,993,mail.in.tum.de,465 diff --git a/share/mailcap b/share/mailcap index 9687b75..f7a7541 100644 --- a/share/mailcap +++ b/share/mailcap @@ -1,7 +1,7 @@ text/plain; $EDITOR %s ; text/html; openfile %s ; nametemplate=%s.html text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput; -image/*; muttimage %s ; copiousoutput +image/*; openfile %s ; video/*; setsid mpv --quiet %s &; copiousoutput application/pdf; openfile %s ; application/pgp-encrypted; gpg -d '%s'; copiousoutput; diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 2c96b19..3dd2f6c 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -5,7 +5,7 @@ # If you want to override any settings, set those in your muttrc. 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 index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" set sort = 'reverse-date' set smtp_authenticators = 'gssapi:login' set query_command = "abook --mutt-query '%s'" @@ -30,6 +30,8 @@ bind index,pager g noop bind index \Cf noop # General rebindings +bind index j next-entry +bind index k previous-entry bind attach view-mailcap bind attach l view-mailcap bind editor noop