sidebar cleanup
This commit is contained in:
parent
2eceb9fdb8
commit
d10219deb3
6
bin/mw
6
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
|
||||
|
Loading…
Reference in New Issue
Block a user