commit d10219deb37f20124ceecda57b5b8772251d0070
parent 2eceb9fdb85b68a29a2a4e309ca6e7216f34d0ee
Author: Luke Smith <luke@lukesmith.xyz>
Date: Mon, 22 Apr 2019 15:46:08 -0400
sidebar cleanup
Diffstat:
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/bin/mw b/bin/mw
@@ -187,18 +187,14 @@ tryconnect() { mkdir -p "$maildir/$title"
finalize() { \
boxes="$(du -a "$maildir/$title/"* -d 0 | sed "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 up the mutt sidebar...\\n"
- sidebar_width="$(sed -n -e '/^set sidebar_width/p' "$muttdir/muttrc" | awk -F'=' '{print $2}')"
- delim="$(head -c "$sidebar_width" < /dev/zero | tr '\0' =)"
printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n"
- oneline="=$title $delim $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")"
spoolfile=$(echo "$boxes" | grep -i -m 1 inbox | sed 's/=/+/g')
record=$(echo "$boxes" | grep -i -m 1 sent | sed 's/=/+/g')
postponed=$(echo "$boxes" | grep -i -m 1 draft | sed 's/=/+/g')
trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g')
sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$accdir/$idnum-$title.muttrc"
{ echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$accdir/$idnum-$title.muttrc"
- echo mailboxes "$oneline" >> "$accdir/$idnum-$title.muttrc"
+ echo "mailboxes =$title ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc"
printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n"
sed -i "/# mw-autogenerated/d" "$accdir/$idnum-$title.muttrc"
echo "$boxes" | grep -i -m 1 inbox | formatShortcut i inbox