summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mailsync8
-rwxr-xr-xbin/muttimage4
-rwxr-xr-xbin/mw11
-rwxr-xr-xbin/openfile2
4 files changed, 11 insertions, 14 deletions
diff --git a/bin/mailsync b/bin/mailsync
index c56ccb2..2cec271 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -20,7 +20,7 @@ command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotif
if [ "$(uname)" = "Darwin" ]; then
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
else
- notify() { notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
+ notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
fi
# Check account for new mail. Notify if there is new content.
@@ -35,7 +35,7 @@ syncandnotify() {
# Extract subject and sender from mail.
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
- notify-send "📧$from:" "$subject" &
+ notify-send --app-name="mutt-wizard" "📧$from:" "$subject" &
done
fi
}
@@ -48,7 +48,7 @@ else
fi
echo " 🔃" > /tmp/imapsyncicon_"$USER"
-pkill -RTMIN+12 i3blocks >/dev/null 2>&1
+pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1
# Parallelize multiple accounts
for account in $accounts
@@ -58,7 +58,7 @@ done
wait
rm -f /tmp/imapsyncicon_"$USER"
-pkill -RTMIN+12 i3blocks >/dev/null 2>&1
+pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1
notmuch new 2>/dev/null
diff --git a/bin/muttimage b/bin/muttimage
index c798293..a846bea 100755
--- a/bin/muttimage
+++ b/bin/muttimage
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/usr/bin/env bash
#get image resolution
resolution=$(identify $1 | awk '{print $3}')
IFS='x' # x is set as delimiter
-read -ra ADDR <<< "$resolution"
+read -ra ADDR <<< "$resolution"
width=${ADDR[0]}
height=${ADDR[1]}
diff --git a/bin/mw b/bin/mw
index a89d5ef..e2939ec 100755
--- a/bin/mw
+++ b/bin/mw
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env 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" ] &&
@@ -8,11 +8,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
-case "$(uname)" in
- Linux) prefix="/usr" ;;
- *) prefix="/usr/local" ;;
-esac
-
+prefix="/usr/local"
muttdir="$HOME/.config/mutt" # Main mutt config location
accdir="$muttdir/accounts" # Directory for account settings
maildir="$HOME/.local/share/mail" # Location of mail storage
@@ -73,6 +69,7 @@ Patterns * !\"[Gmail]/All Mail\"
Create Both
SyncState *
MaxMessages $maxmes
+ExpireUnread no
# End profile
"
@@ -242,7 +239,7 @@ finalize() { \
trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g')
sed -ibu "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu"
{ echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$accdir/$idnum-$title.muttrc"
- echo "mailboxes =$title ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc"
+ echo "mailboxes $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc"
printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n"
sed -ibu "/# mw-autogenerated/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu"
echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox
diff --git a/bin/openfile b/bin/openfile
index e530b3e..b16483b 100755
--- a/bin/openfile
+++ b/bin/openfile
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env 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"