From 91242ee6cdcf929e651dd31c04b0939e1d9ab52a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 1 Dec 2019 10:14:31 -0500 Subject: move and copy tagged messages if any --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index e2939ec..568fef0 100755 --- a/bin/mw +++ b/bin/mw @@ -214,8 +214,8 @@ getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1 formatShortcut() { \ while read -r data; do { echo "macro index,pager g$1 \"$data\" \"go to $2\" # mw-autogenerated" - echo "macro index,pager M$1 \"$data\" \"move mail to $2\" # mw-autogenerated" - echo "macro index,pager C$1 \"$data\" \"copy mail to $2\" # mw-autogenerated"; } >> "$accdir/$idnum-$title.muttrc" + echo "macro index,pager M$1 \";$data\" \"move mail to $2\" # mw-autogenerated" + echo "macro index,pager C$1 \";$data\" \"copy mail to $2\" # mw-autogenerated"; } >> "$accdir/$idnum-$title.muttrc" done ;} tryconnect() { mkdir -p "$maildir/$title" -- cgit v1.2.3 From 9b511f42f74633cd15240a1561c00b28ba8b8fdc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 9 Feb 2020 07:49:12 -0500 Subject: find mailboxes recursively --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 568fef0..0e39046 100755 --- a/bin/mw +++ b/bin/mw @@ -230,7 +230,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') -- cgit v1.2.3 From 27ac8c6aa9af0bc93c5f39981a3c2f008c2945cc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 9 Feb 2020 08:01:37 -0500 Subject: AuthMech LOGIN --- bin/mw | 1 + 1 file changed, 1 insertion(+) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 0e39046..9302627 100755 --- a/bin/mw +++ b/bin/mw @@ -53,6 +53,7 @@ Port $iport User $login PassCmd \"pass mutt-wizard-$title\" SSLType $ssltype +AuthMech LOGIN CertificateFile $sslcert MaildirStore $title-local -- cgit v1.2.3 From f9b31cbd9951dd4b383f3446975fa4f5af24dbca Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 9 Feb 2020 08:18:32 -0500 Subject: must type full yes --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 9302627..576e90b 100755 --- a/bin/mw +++ b/bin/mw @@ -255,8 +255,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" -- cgit v1.2.3 From 4cb726546f679bdbab95a7e81937fe6d278578c0 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 9 Feb 2020 08:57:52 -0500 Subject: cron fixes and simplifications --- bin/mailsync | 16 +++++++++------- bin/mw | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'bin/mw') diff --git a/bin/mailsync b/bin/mailsync index 2d82690..419848d 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -1,12 +1,6 @@ -#!/usr/bin/env sh +#!/bin/sh # Sync mail and give notification if there is new mail. -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" - # 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 ;} # Run only if not already running in other instance @@ -16,6 +10,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/mw b/bin/mw index 576e90b..98f2b99 100755 --- a/bin/mw +++ b/bin/mw @@ -290,7 +290,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 ;} -- cgit v1.2.3 From d8f57b57f6e4f7d07969a26775686b45b0e2b565 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 9 Feb 2020 09:03:10 -0500 Subject: muttimage replaced by openfile --- bin/mailsync | 1 + bin/muttimage | 11 ----------- bin/mw | 3 ++- bin/openfile | 3 ++- share/mailcap | 2 +- 5 files changed, 6 insertions(+), 14 deletions(-) delete mode 100755 bin/muttimage (limited to 'bin/mw') diff --git a/bin/mailsync b/bin/mailsync index 419848d..326279c 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -1,4 +1,5 @@ #!/bin/sh + # Sync mail and give notification if there is new mail. # Run only if user logged in (prevent cron errors) 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 98f2b99..616b528 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" ] && 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/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; -- cgit v1.2.3 From 82c01a9a6b5bc853f184f56fc43b47e92c0a73df Mon Sep 17 00:00:00 2001 From: grenzionky Date: Sat, 29 Feb 2020 05:58:07 -0500 Subject: add current email to status bar (#373) when u have multiple emails in neomutt at the same time, you can sometimes forget which email u'r currently viewing, so with this addition youll be able to see. all i did was add the email to the default status bar configuration --- bin/mw | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 616b528..52a24b0 100755 --- a/bin/mw +++ b/bin/mw @@ -86,6 +86,7 @@ set folder = \"$maildir/$title\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set mbox_type = Maildir +set status_format="-%r-"$from": %D [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---" bind index,pager gg noop bind index,pager g noop @@ -107,6 +108,7 @@ set imap_user = \"$login\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set imap_pass = \"\`pass mutt-wizard-$title\`\" +set status_format="-%r-"$from": %D [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---" set mbox_type = Maildir set ssl_starttls = yes -- cgit v1.2.3 From a2ea17e9b4a8341c2a8883cd37fd0451f22f9071 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 29 Feb 2020 06:01:54 -0500 Subject: changes --- README.md | 3 +-- bin/mw | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'bin/mw') diff --git a/README.md b/README.md index 1b72ef8..e603745 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The mutt-wizard is run with the command `mw`. It also installs the `mailsync` co - `mw add` -- add a new email account - `mw ls` -- list existing accounts - `mw pass` -- revise an account's password -- `mw delete` -- deleted an added account +- `mw delete` -- delete an added account - `mw purge` -- delete all accounts and settings - `mw cron` -- toggle/configure a cronjob to sync mail @@ -114,4 +114,3 @@ mutt-wizard is free/libre software, licensed under the GPLv3. - Add ~~Mac OS~~/BSD compatibility (the script is confired to work for Mac OS now) - ~~Out-of-the-box compatibility with Protonmail Bridge~~ (I believe this is done, but more bug-testing is welcome since I don't have PM) -- Option to keep configuration for accounts that failed to connect (maybe) diff --git a/bin/mw b/bin/mw index 616b528..0fd6375 100755 --- a/bin/mw +++ b/bin/mw @@ -4,7 +4,7 @@ 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" ] && "$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.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 \`.\\nIf you don't have a GPG public private key pair, run \`$GPG --full-gen-key\` first.\\n" + printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" exit } ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit -- cgit v1.2.3 From ee6101cb6e787255b19dcae035dd6b2be3a26f73 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 29 Feb 2020 16:58:32 -0500 Subject: undo retarded error --- bin/mw | 2 -- 1 file changed, 2 deletions(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 8202699..0fd6375 100755 --- a/bin/mw +++ b/bin/mw @@ -86,7 +86,6 @@ set folder = \"$maildir/$title\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set mbox_type = Maildir -set status_format="-%r-"$from": %D [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---" bind index,pager gg noop bind index,pager g noop @@ -108,7 +107,6 @@ set imap_user = \"$login\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set imap_pass = \"\`pass mutt-wizard-$title\`\" -set status_format="-%r-"$from": %D [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---" set mbox_type = Maildir set ssl_starttls = yes -- cgit v1.2.3 From 73bb120cc246a60c3ba0bf3ba414a0e357cb4c8a Mon Sep 17 00:00:00 2001 From: Chau Bao Long Date: Mon, 23 Mar 2020 04:13:56 +0700 Subject: Fix Error: SASL(-7) with isync on macos. (#222) Co-authored-by: chau.bao.long --- bin/mw | 1 + 1 file changed, 1 insertion(+) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 0fd6375..e7a673a 100755 --- a/bin/mw +++ b/bin/mw @@ -53,6 +53,7 @@ Host $imap Port $iport User $login PassCmd \"pass mutt-wizard-$title\" +AuthMechs LOGIN SSLType $ssltype AuthMech LOGIN CertificateFile $sslcert -- cgit v1.2.3 From 789f5932720fb05a232460ad89a8ef5fb8e46454 Mon Sep 17 00:00:00 2001 From: Lingyu Zhu <302590304@qq.com> Date: Sun, 5 Apr 2020 21:11:55 +0800 Subject: remove unnecessary prefix setting up msmtp. (#401) the prefix is not correct at least for Ubuntu distro. Since doc clearly states the dependencis. We assume msmpt is on the PATH environment. Co-authored-by: Lingyu Zhu --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index e7a673a..862f937 100755 --- a/bin/mw +++ b/bin/mw @@ -101,7 +101,7 @@ mutt_profile="# vim: filetype=neomuttrc # muttrc file for account $title set realname = \"$realname\" set from = \"$fulladdr\" -set sendmail = \"$prefix/bin/msmtp -a $title\" +set sendmail = \"msmtp -a $title\" alias me $realname <$fulladdr> set folder = \"imaps://$fulladdr@$imap:$iport\" set imap_user = \"$login\" -- cgit v1.2.3 From 15151c8b442f2345cc621d43f498276137718f30 Mon Sep 17 00:00:00 2001 From: Jackson Law <178053+jlaw@users.noreply.github.com> Date: Sat, 18 Apr 2020 07:49:29 -0700 Subject: Remove AuthMech misspelled option (#415) According to man page of mbsync, AuthMechs is the correct spelling of the option. --- bin/mw | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 862f937..97b0172 100755 --- a/bin/mw +++ b/bin/mw @@ -50,12 +50,11 @@ $starttlsoff " mbsync_profile="IMAPStore $title-remote Host $imap -Port $iport +Port $iport User $login PassCmd \"pass mutt-wizard-$title\" AuthMechs LOGIN SSLType $ssltype -AuthMech LOGIN CertificateFile $sslcert MaildirStore $title-local -- cgit v1.2.3 From 3ee9cb73a0636aa2bae0c0417e1e8be52a8cbe5e Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Apr 2020 15:21:40 -0400 Subject: notmuch ignores mbsync files by default --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 97b0172..ab941a8 100755 --- a/bin/mw +++ b/bin/mw @@ -321,7 +321,7 @@ name=$realname primary_email=$fulladdr [new] tags=unread;inbox; -ignore= +ignore=.mbsyncstate;.uidvalidity [search] exclude_tags=deleted;spam; [maildir] -- cgit v1.2.3 From aaeb0a73dc0904f9258743683e96e2439f88ba56 Mon Sep 17 00:00:00 2001 From: qorg11 Date: Mon, 25 May 2020 12:38:07 +0200 Subject: Fix set_folder for vxempire.xyz (#441) * Added vxempire.xyz to domains.cvs * Fixed set_folder for vxempire.xyz --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index ab941a8..981f3d2 100755 --- a/bin/mw +++ b/bin/mw @@ -102,7 +102,7 @@ set realname = \"$realname\" set from = \"$fulladdr\" set sendmail = \"msmtp -a $title\" alias me $realname <$fulladdr> -set folder = \"imaps://$fulladdr@$imap:$iport\" +set folder = \"imaps://$login@$imap:$iport\" set imap_user = \"$login\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies -- cgit v1.2.3 From 12e37fce3c07edfbfb8b3d3049f4710b3bb6a13c Mon Sep 17 00:00:00 2001 From: qorg11 Date: Sun, 31 May 2020 12:22:00 +0200 Subject: Added pgp (gpg) support by default (#447) * mutt-wizard works on FreeBSD, also changed mbsync with isync (actual package name) * Added pgp support --- README.md | 2 +- bin/mw | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'bin/mw') diff --git a/README.md b/README.md index fc0b51a..0123fba 100644 --- a/README.md +++ b/README.md @@ -112,5 +112,5 @@ mutt-wizard is free/libre software, licensed under the GPLv3. ## To-do -- Add ~~Mac OS~~/BSD compatibility (the script is confired to work for Mac OS now) +- Add ~~Mac OS~~/~~BSD~~ compatibility (the script is confired to work for Mac OS and FreeBSD now) - ~~Out-of-the-box compatibility with Protonmail Bridge~~ (I believe this is done, but more bug-testing is welcome since I don't have PM) diff --git a/bin/mw b/bin/mw index 981f3d2..e62be2a 100755 --- a/bin/mw +++ b/bin/mw @@ -7,7 +7,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" exit } -! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit +! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit prefix="/usr/local" muttdir="$HOME/.config/mutt" # Main mutt config location @@ -86,6 +86,9 @@ set folder = \"$maildir/$title\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set mbox_type = Maildir +set crypt_opportunistic_encrypt = yes +set pgp_self_encrypt = yes +set pgp_default_key = $keyid bind index,pager gg noop bind index,pager g noop @@ -108,6 +111,11 @@ set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set imap_pass = \"\`pass mutt-wizard-$title\`\" +set crypt_opportunistic_encrypt = yes +set pgp_self_encrypt = yes +set pgp_default_key = $keyid + + set mbox_type = Maildir set ssl_starttls = yes set ssl_force_tls = yes @@ -126,6 +134,7 @@ fi askinfo() { \ printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m" read -r fulladdr + keyid=$( gpg --list-keys --with-colons $fulladdr | awk -F: '/^pub:/ { print $5 }') printf "\033[0m" while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t" -- cgit v1.2.3 From bb72cf5a71418a3d8eaa3cc731a2b8a8627e9c1c Mon Sep 17 00:00:00 2001 From: JameyBear Date: Sun, 31 May 2020 12:10:35 -0400 Subject: Cleanup (#450) * Simple Fixes * Tweak wording * Update openfile * ShellChecked * Little Fixes --- bin/mailsync | 4 ++-- bin/mw | 8 ++++---- bin/openfile | 2 +- mw.1 | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'bin/mw') diff --git a/bin/mailsync b/bin/mailsync index 6aeb946..6128f41 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -12,7 +12,7 @@ ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; e 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 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus export DISPLAY=:0.0 # For individual configurations: @@ -30,7 +30,7 @@ fi # Check account for new mail. Notify if there is new content. syncandnotify() { acc="$(echo "$account" | sed "s/.*\///")" - mbsync $opts "$acc" + mbsync "$opts" "$acc" new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) if [ "$newcount" -gt "0" ]; then diff --git a/bin/mw b/bin/mw index e62be2a..0862f30 100755 --- a/bin/mw +++ b/bin/mw @@ -3,7 +3,7 @@ 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" ] && - "$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.gpg-id") >/dev/null 2>&1 || { + "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.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 \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" exit } @@ -134,7 +134,7 @@ fi askinfo() { \ printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m" read -r fulladdr - keyid=$( gpg --list-keys --with-colons $fulladdr | awk -F: '/^pub:/ { print $5 }') + keyid=$( gpg --list-keys --with-colons "$fulladdr" | awk -F: '/^pub:/ { print $5 }') printf "\033[0m" while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t" @@ -145,7 +145,7 @@ askinfo() { \ search_query=$domain case "$domain" in protonmail.com|protonmail.ch|pm.me) - search_query='protonmail.com' && break;; + search_query='protonmail.com' && return 1;; *) while : ; do printf "\nIs your email hosted with Protonmail? [yes/no] " @@ -339,7 +339,7 @@ synchronize_flags=true gpg_path=$GPG" echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} -trap 'echo -e "\033[0m\n"; exit' STOP INT ABRT KILL +trap 'echo -e "\033[0m\n"; exit' INT ABRT case "$1" in ls) list ;; diff --git a/bin/openfile b/bin/openfile index c0e2e9c..f6668dc 100755 --- a/bin/openfile +++ b/bin/openfile @@ -1,7 +1,7 @@ #!/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" +[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid xdg-open" mkdir -p "/tmp/$USER-mutt-tmp" file="/tmp/$USER-mutt-tmp/$(basename "$1")" rm -f "$file" diff --git a/mw.1 b/mw.1 index c866c83..217ae2b 100644 --- a/mw.1 +++ b/mw.1 @@ -6,7 +6,7 @@ mw \- mutt-wizard \- autoconfigure email accounts for neomutt and isync .SH DESCRIPTION .B mw -takes a user email account and sets up a terminal-based email interface with it for +takes a user email account and sets up a terminal-based email interface for it with .B neomutt. This can include offline email with .B isync/mbsync -- cgit v1.2.3 From 591145b653dbbe1effa2eb8cf4e4e53a8e51e880 Mon Sep 17 00:00:00 2001 From: qorg11 Date: Mon, 1 Jun 2020 13:45:20 +0200 Subject: Auto sign emails using pgp (#451) --- bin/mw | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 0862f30..ed4f278 100755 --- a/bin/mw +++ b/bin/mw @@ -86,6 +86,8 @@ set folder = \"$maildir/$title\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set mbox_type = Maildir + +set crypt_autosign = yes set crypt_opportunistic_encrypt = yes set pgp_self_encrypt = yes set pgp_default_key = $keyid @@ -111,6 +113,7 @@ set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set imap_pass = \"\`pass mutt-wizard-$title\`\" +set crypt_autosign = yes set crypt_opportunistic_encrypt = yes set pgp_self_encrypt = yes set pgp_default_key = $keyid -- cgit v1.2.3 From d90b668d4e2d37295022ddcbaa9536a4bbbfe16d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 4 Jun 2020 18:47:13 -0400 Subject: fix #452 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index ed4f278..1d7ed07 100755 --- a/bin/mw +++ b/bin/mw @@ -137,7 +137,7 @@ fi askinfo() { \ printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m" read -r fulladdr - keyid=$( gpg --list-keys --with-colons "$fulladdr" | awk -F: '/^pub:/ { print $5 }') + keyid=$("$GPG" --list-keys --with-colons "$fulladdr" | awk -F: '/^pub:/ { print $5 }') printf "\033[0m" while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t" -- cgit v1.2.3 From c25bac2cf9c70a25a3ff3182f6a0f0bd11bf2276 Mon Sep 17 00:00:00 2001 From: Petrus Date: Sun, 7 Jun 2020 04:51:49 +0800 Subject: make crontab quite (#416) Let's make crontab a little quiet here, unless for those who set up mail for crontab error handling will be disturbed every few minutes. --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 1d7ed07..5293c5d 100755 --- a/bin/mw +++ b/bin/mw @@ -303,7 +303,7 @@ choosecron() { ! pgrep cron >/dev/null && echo "No cron manager running. Install read -r minnum printf "\033[0m" done - (crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3)") | crontab - && + (crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3)") >/dev/null | crontab - && echo "Cronjob added. Mail will sync every $minnum minutes. Be sure you have your cron manager running." fi ;} -- cgit v1.2.3 From 76417d7b071b4a82338eb81ff835de2c070ea104 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 9 Jun 2020 13:41:38 +0100 Subject: fix crontab set (#457) I think a recent change tried to send output from crontab to dev/null to avoid messages appearing a) when setting the crontab, b) whenever mailsync is run. However the redirection was for the string concatenation meaning a null string was piped to cron obliterating the crontab (thank goodness for backups). I have put the redirection in the correct location (similar to a few lines above when removing the mailsync line). I have also redirected all output of the mailsync (both errors and normal messages) to dev null. Co-authored-by: rjl6789 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 5293c5d..1d986d1 100755 --- a/bin/mw +++ b/bin/mw @@ -303,7 +303,7 @@ choosecron() { ! pgrep cron >/dev/null && echo "No cron manager running. Install read -r minnum printf "\033[0m" done - (crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3)") >/dev/null | crontab - && + (crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3) >/dev/null 2>&1") | crontab - >/dev/null && echo "Cronjob added. Mail will sync every $minnum minutes. Be sure you have your cron manager running." fi ;} -- cgit v1.2.3 From ca5c623855133903521dedb1dca08373ba762948 Mon Sep 17 00:00:00 2001 From: Rob Date: Fri, 12 Jun 2020 11:43:26 +0100 Subject: fix premature return from askinfo (#463) I believe this addresses issue #456 where if you add a protonmail account you get an error. This is caused by prematurely returning from the case statement that queries whether you have a protonmail account or not. Co-authored-by: rjl6789 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index 1d986d1..c7a5c62 100755 --- a/bin/mw +++ b/bin/mw @@ -148,7 +148,7 @@ askinfo() { \ search_query=$domain case "$domain" in protonmail.com|protonmail.ch|pm.me) - search_query='protonmail.com' && return 1;; + search_query='protonmail.com' ;; *) while : ; do printf "\nIs your email hosted with Protonmail? [yes/no] " -- cgit v1.2.3 From 497839b1ee804d86f9dac453108c7bbf071060ee Mon Sep 17 00:00:00 2001 From: Fraser Li <55525214+fraserli@users.noreply.github.com> Date: Mon, 22 Jun 2020 21:41:07 +1000 Subject: Added support for multiple gpg keys with pass (#472) --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') diff --git a/bin/mw b/bin/mw index c7a5c62..9bf00c3 100755 --- a/bin/mw +++ b/bin/mw @@ -3,7 +3,7 @@ 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" ] && - "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&1 || { + "$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.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 \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" exit } -- cgit v1.2.3