diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mailsync | 6 | ||||
-rwxr-xr-x | bin/mw | 12 | ||||
-rwxr-xr-x | bin/openfile | 5 |
3 files changed, 11 insertions, 12 deletions
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/"* @@ -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 @@ -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') 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 & |