From 49d2e12125f7881e43ebc57895c8eb8a13a8706c Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Wed, 15 May 2019 20:19:55 +0200 Subject: check if .gpg-id is in the pass store on startup The current test did not terminate the script in cases when the user already has a private GPG key, but they'd not initialized the password store. This leads to an infinite loop in the `getpass()` function. The commit fixes https://github.com/LukeSmithxyz/mutt-wizard/issues/204 --- bin/mw | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/mw b/bin/mw index 636a837..a415f0e 100755 --- a/bin/mw +++ b/bin/mw @@ -1,6 +1,10 @@ #!/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 \`.\\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 \`.\\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 -- cgit v1.2.3 From 46c796ef641ae286894dfd22cef62c62a425a204 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 16 May 2019 13:59:09 -0400 Subject: fatal breakage fixed --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/mw b/bin/mw index a415f0e..7eefed9 100755 --- a/bin/mw +++ b/bin/mw @@ -7,7 +7,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 -if [[ "$OSTYPE" == "darwin"* ]]; then +if [ "$OSTYPE" = "darwin" ]; then prefix="/usr/local" else prefix="/usr" -- cgit v1.2.3 From f807448b649f382a73d60cce4a6d0dcffce7decc Mon Sep 17 00:00:00 2001 From: Alex Voloshyn Date: Mon, 20 May 2019 13:48:14 +0900 Subject: use image resolution instead of window row/col size to display the image attachment --- bin/muttimage | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/muttimage b/bin/muttimage index 03bd5f3..c798293 100755 --- 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 & -- cgit v1.2.3 From 4c57b410fc72d332ccdcf939e58521a248ca5fd0 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 20 May 2019 12:59:27 -0400 Subject: gnuisms removed --- bin/mailsync | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/mailsync b/bin/mailsync index 43429f5..b038fe6 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -2,7 +2,7 @@ # Sync mail and give notification if there is new mail. # Run only if user logged in (prevent cron errors) -pgrep -cu "$USER" >/dev/null || exit +pgrep -u "$USER" >/dev/null || exit # Checks for internet connection and set notification script. ping -q -c 1 1.1.1.1 > /dev/null || exit @@ -18,7 +18,7 @@ else fi echo " 🔃" > /tmp/imapsyncicon_$USER -pkill -RTMIN+12 i3blocks +pkill -RTMIN+12 i3blocks >/dev/null 2>&1 # Run mbsync. You can feed this script different settings. if [ $# -eq 0 ]; then @@ -28,7 +28,7 @@ else fi rm -f /tmp/imapsyncicon_$USER -pkill -RTMIN+12 i3blocks +pkill -RTMIN+12 i3blocks >/dev/null 2>&1 # Check all accounts/mailboxes for new mail. Notify if there is new content. for account in "$HOME/.local/share/mail/"* -- cgit v1.2.3 From a6c81625c8ed887b7ddbfed005d2a2ffdf27a503 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 20 May 2019 13:09:11 -0400 Subject: posix and mac fix --- bin/mw | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/mw b/bin/mw index 7eefed9..1cae8fc 100755 --- a/bin/mw +++ b/bin/mw @@ -7,11 +7,11 @@ 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 -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 -- cgit v1.2.3 From e4794af679e0d79b222930d034e98ca7116c8ccd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 20 May 2019 13:44:51 -0400 Subject: escape spaces in mailboxes --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/mw b/bin/mw index 1cae8fc..b693299 100755 --- a/bin/mw +++ b/bin/mw @@ -216,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') -- cgit v1.2.3 From 55e3bb683c908f9962941ce9f4f6dcacc151291b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 20 May 2019 15:41:03 -0400 Subject: portable openfile --- bin/openfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/openfile b/bin/openfile index a3163f3..e530b3e 100755 --- 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 & -- cgit v1.2.3 From e4813ae21568132e2dd04f0d69e87c4dfd98c3c6 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Tue, 28 May 2019 01:09:25 +0200 Subject: restore default text color on 'Ctrl-C' exit The terminal text color wasn't reset when the user aborted the wizard while being prompted for input. This resolves https://github.com/LukeSmithxyz/mutt-wizard/issues/224 --- bin/mw | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bin') diff --git a/bin/mw b/bin/mw index b693299..f8c4f24 100755 --- a/bin/mw +++ b/bin/mw @@ -313,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 ;; -- cgit v1.2.3