[neomutt] Fix mailboxes loading for NeoMutt 20191111
This commit is contained in:
parent
be4bd80c08
commit
f920216d16
3 changed files with 35 additions and 3 deletions
config/neomutt
|
@ -1,7 +1,17 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "$0 <mutt \$folder>"
|
||||||
|
echo " Generate mutt folder hooks for every maildir account in \$folder"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
acc_dir="$HOME/.config/neomutt/accounts/"
|
acc_dir="$HOME/.config/neomutt/accounts/"
|
||||||
mail_dir="$HOME/mail/"
|
mail_dir="$1"
|
||||||
|
|
||||||
# Select default account
|
# Select default account
|
||||||
default="$(find "$acc_dir" -name "*.mail" -printf "source '%p'\n" -quit)"
|
default="$(find "$acc_dir" -name "*.mail" -printf "source '%p'\n" -quit)"
|
||||||
|
|
22
config/neomutt/mailboxes.sh
Executable file
22
config/neomutt/mailboxes.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "$0 <neomutt \$folder>"
|
||||||
|
echo " Generate neomutt mailboxes & named-mailboxes for every maildir in \$folder"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
maildir="$1"
|
||||||
|
|
||||||
|
mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch)
|
||||||
|
|
||||||
|
for m in $mailboxes; do
|
||||||
|
inbox="$(find "$m" -maxdepth 1 -iname "inbox" -type d -printf "%f" -quit)"
|
||||||
|
echo "named-mailboxes '$(basename "$m")' '$m/$inbox'"
|
||||||
|
printf "mailboxes "
|
||||||
|
find "$m" -mindepth 1 -type d ! -name cur ! -name tmp ! -name new -printf '"%p"\0' | xargs -0
|
||||||
|
done
|
|
@ -3,7 +3,7 @@ set mbox_type = Maildir
|
||||||
set copy # See also $record (f*ckin recursion)
|
set copy # See also $record (f*ckin recursion)
|
||||||
set folder = "~/mail"
|
set folder = "~/mail"
|
||||||
unmailboxes *
|
unmailboxes *
|
||||||
mailboxes `find ~/mail -mindepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
|
source "~/.config/neomutt/mailboxes.sh $folder|"
|
||||||
|
|
||||||
# Load external configs
|
# Load external configs
|
||||||
source sidebar.rc
|
source sidebar.rc
|
||||||
|
@ -12,7 +12,7 @@ source gpg.rc
|
||||||
source keys.rc
|
source keys.rc
|
||||||
|
|
||||||
# Accounts
|
# Accounts
|
||||||
source '~/.config/neomutt/folder-hooks.sh|'
|
source "~/.config/neomutt/folder-hooks.sh $folder|"
|
||||||
|
|
||||||
# Basic options
|
# Basic options
|
||||||
unset wait_key # Only wait if command exited != 0
|
unset wait_key # Only wait if command exited != 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue