diff --git a/bin/mailsync b/bin/mailsync index 256ebf7..fb328cf 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -18,7 +18,7 @@ if [ -e "$LOCKFILE" ] && kill -0 "$(cat "$LOCKFILE")"; then fi # make sure the lockfile is removed when we exit and then claim it -trap "rm -f $LOCKFILE; exit" INT TERM EXIT +trap "rm -f '$LOCKFILE'; exit" INT TERM EXIT echo $$ > "$LOCKFILE" # Try a single short sync to test password availability diff --git a/config/neomutt/common.rc b/config/neomutt/common.rc index 6de2b52..e6ec84e 100644 --- a/config/neomutt/common.rc +++ b/config/neomutt/common.rc @@ -65,7 +65,7 @@ unignore Organization X-Label X-Mailer User-Agent # Compose # ########### # https://www.zigg.com/2018/natalie-nguyen.html -my_hdr X-Clacks-Overhead: GNU Natalie Nguyen, Terry Pratchett +my_hdr X-Clacks-Overhead: GNU Laura, Natalie Nguyen, Terry Pratchett set use_from # set a From: header set use_envelope_from # which from? set sig_dashes # dashes before sig diff --git a/config/neomutt/keys.rc b/config/neomutt/keys.rc index 30b929d..1f4c5b7 100644 --- a/config/neomutt/keys.rc +++ b/config/neomutt/keys.rc @@ -2,10 +2,14 @@ # GENERAL # ########### bind index,pager N search-opposite -bind index,pager \Cu half-up -bind index,pager \Cd half-down -bind index,pager g noop # required to define multikeys binds +bind generic,index,pager \Cu half-up +bind generic,index,pager \Cd half-down +bind generic,index,pager g noop # required to define multikeys binds +bind generic,index gg first-entry +bind generic,index G last-entry + bind index,pager sync-mailbox + macro index,pager ga "mailsync" "Sync all IMAP mailboxes" ########### @@ -21,8 +25,6 @@ bind index,pager B sidebar-toggle-visible # Toggle sidebar ######### # INDEX # ######### -bind index gg first-entry -bind index G last-entry bind index h noop # display-toggle-weed is rubbish in index view bind index l display-message bind index p recall-message @@ -57,8 +59,7 @@ macro pager gu " urlscan " ########## # ATTACH # ########## -# http://stevelosh.com/blog/2012/10/the-homely-mutt/ -bind attach l view-mailcap +bind attach l view-text # Force viewing as text ########### # NOTMUCH # @@ -82,7 +83,7 @@ bind compose P pgp-menu ########### # Browser # ########### -bind browser l select-entry +bind browser l descend-directory bind browser h goto-parent # vim: syntax=neomuttrc diff --git a/config/neomutt/mailboxes.sh b/config/neomutt/mailboxes.sh index 72892bc..9a14b28 100755 --- a/config/neomutt/mailboxes.sh +++ b/config/neomutt/mailboxes.sh @@ -1,7 +1,7 @@ #!/bin/sh usage() { - >&2 echo "$0 " + >&2 echo "$0 " >&2 echo " Generate neomutt mailboxes & named-mailboxes for every maildir in \$folder" exit 1 } @@ -12,11 +12,18 @@ fi maildir="$1" -mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch) +mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch | sort) + +# Order of the keys to use for the account switch macro +chars="1234567890azertyuiopqsdfghjklmwxcvbn" +i=1 for m in $mailboxes; do inbox="$(find "$m" -maxdepth 1 -iname "inbox" -type d -printf "%f" -quit)" - echo "named-mailboxes '$(basename "$m")' '$m/$inbox'" + key="$(printf '%s' "$chars" | cut -c "$i")" + printf "named-mailboxes '[%s] %s' '%s'\n" "$key" "$(basename "$m")" "$m/$inbox" + printf "sidebar_whitelist '%s'\n" "$m/$inbox" printf "mailboxes " find "$m" -mindepth 1 -type d ! -name cur ! -name tmp ! -name new -printf '"%p"\0' | xargs -0 + i=$((i+1)) done diff --git a/config/neomutt/sidebar.rc b/config/neomutt/sidebar.rc index c4db799..5fca677 100644 --- a/config/neomutt/sidebar.rc +++ b/config/neomutt/sidebar.rc @@ -1,9 +1,9 @@ set sidebar_visible set mail_check_stats # update unread/flagged/total counts -set sidebar_format = '%B%?F? [%!]?%* %?N?%N/?%?S?%S?' +set sidebar_format = '%D%?F? [%!]?%* %?N?%N/?%?S?%S?' set sidebar_width = 32 # Note: some chars take two columns (chinese) set sidebar_short_path # Keep only end of mailbox path -set sidebar_component_depth = 0 # nb of parent subdirs to hide +set sidebar_component_depth = 1 # nb of parent subdirs to hide set sidebar_delim_chars = '/.' # mailbox path sep, '.' is used with IMAP set sidebar_divider_char = '|' # UI separator bar char set sidebar_folder_indent # indent according to path tree