Browse Source

hardcode mailbox names. don't remake shortcuts.

tags/v3.3
Luke Smith 3 years ago
parent
commit
bd0075898a
No known key found for this signature in database GPG Key ID: 4C50B54A911F6252
6 changed files with 43 additions and 67 deletions
  1. +2
    -2
      Makefile
  2. +1
    -1
      bin/mailsync
  3. +7
    -27
      bin/mw
  4. +23
    -0
      share/mutt-wizard.muttrc
  5. +10
    -0
      share/switch.muttrc
  6. +0
    -37
      share/unbind.muttrc

+ 2
- 2
Makefile View File

@@ -14,8 +14,8 @@ install:
chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile
mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard
cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/unbind.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/unbind.muttrc
cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/switch.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/switch.muttrc
mkdir -p $(DESTDIR)$(MANPREFIX)/man1 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1


+ 1
- 1
bin/mailsync View File

@@ -36,7 +36,7 @@ case "$(uname)" in
;; ;;
*) *)
case "$(readlink -f /sbin/init)" in case "$(readlink -f /sbin/init)" in
*systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
*systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
esac esac
# remember if a display server is running since `ps` doesn't always contain a display # remember if a display server is running since `ps` doesn't always contain a display
pgrepoutput="$(pgrep -a X\(org\|wayland\))" pgrepoutput="$(pgrep -a X\(org\|wayland\))"


+ 7
- 27
bin/mw View File

@@ -101,7 +101,11 @@ set header_cache = $cachedir/$fulladdr/headers
set message_cachedir = $cachedir/$fulladdr/bodies set message_cachedir = $cachedir/$fulladdr/bodies
set mbox_type = Maildir set mbox_type = Maildir
set hostname = \"$hostname\" set hostname = \"$hostname\"
source $muttshare/unbind.muttrc
source $muttshare/switch.muttrc
set spoolfile = "+INBOX"
set postponed = "+Drafts"
set trash = "+Trash"
set record = "+Sent"
$extra $extra
$synccmd $synccmd
" > "$accdir/$fulladdr.muttrc" " > "$accdir/$fulladdr.muttrc"
@@ -135,7 +139,6 @@ set ssl_force_tls = yes"
esac esac
prepmsmtp prepmsmtp
prepmutt prepmutt

prepnotmuch # Create a notmuch config file if not present already. prepnotmuch # Create a notmuch config file if not present already.
} }


@@ -211,14 +214,6 @@ createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr"
getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1
pass insert -f "$fulladdr" && break; done ;} pass insert -f "$fulladdr" && break; done ;}


formatShortcut() { toappend="$toappend
macro index,pager g$1 \"<change-folder>=$3<enter>\" \"go to $2\"
macro index,pager M$1 \";<save-message>=$3<enter>\" \"move mail to $2\"
macro index,pager C$1 \";<copy-message>=$3<enter>\" \"copy mail to $2\"" ;}

setBox() { toappend="$toappend
set $1 = \"+$2\"" ;}

getboxes() { if [ -n "${force+x}" ] ; then getboxes() { if [ -n "${force+x}" ] ; then
mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")"
else else
@@ -232,20 +227,6 @@ getboxes() { if [ -n "${force+x}" ] ; then
[ $idnum -eq $x ] || break [ $idnum -eq $x ] || break
done done
toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`"
IFS='
'
for x in $mailboxes; do
case "$x" in
*[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;;
*[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;;
*[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;;
*[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;;
*[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;;
*[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;;
*[Ii][Nn][Bb][Oo][Xx]) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;;
esac
done
unset IFS
} }


finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc"
@@ -257,7 +238,7 @@ finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc"
prepnotmuch() { \ prepnotmuch() { \
[ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config"
[ -f "$NOTMUCH_CONFIG" ] && return 0 [ -f "$NOTMUCH_CONFIG" ] && return 0
nmbasic="[database]
echo "[database]
path=$maildir path=$maildir
[user] [user]
name=$realname name=$realname
@@ -270,8 +251,7 @@ exclude_tags=deleted;spam;
[maildir] [maildir]
synchronize_flags=true synchronize_flags=true
[crypto] [crypto]
gpg_path=$GPG"
echo "$nmbasic" > "$NOTMUCH_CONFIG" ;}
gpg_path=$GPG" > "$NOTMUCH_CONFIG" ;}


togglecron() { cron="$(mktemp)" togglecron() { cron="$(mktemp)"
crontab -l > "$cron" crontab -l > "$cron"


+ 23
- 0
share/mutt-wizard.muttrc View File

@@ -27,11 +27,15 @@ auto_view text/html # automatically show html (mailcap uses lynx)
auto_view application/pgp-encrypted auto_view application/pgp-encrypted
#set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages.
alternative_order text/plain text/enriched text/html alternative_order text/plain text/enriched text/html

bind index,pager i noop bind index,pager i noop
bind index,pager g noop bind index,pager g noop
bind index \Cf noop bind index \Cf noop
bind index,pager M noop
bind index,pager C noop


# General rebindings # General rebindings
bind index gg first-entry
bind index j next-entry bind index j next-entry
bind index k previous-entry bind index k previous-entry
bind attach <return> view-mailcap bind attach <return> view-mailcap
@@ -65,6 +69,25 @@ bind pager \031 previous-line # Mouse wheel
bind pager \005 next-line # Mouse wheel bind pager \005 next-line # Mouse wheel
bind editor <Tab> complete-query bind editor <Tab> complete-query


macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox"
macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox"
macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox"
macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts"
macro index,pager Md ";<save-message>=Drafts<enter>" "move mail to drafts"
macro index,pager Cd ";<copy-message>=Drafts<enter>" "copy mail to drafts"
macro index,pager gj "<change-folder>=Junk<enter>" "go to junk"
macro index,pager Mj ";<save-message>=Junk<enter>" "move mail to junk"
macro index,pager Cj ";<copy-message>=Junk<enter>" "copy mail to junk"
macro index,pager gt "<change-folder>=Trash<enter>" "go to trash"
macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to trash"
macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash"
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent"
macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to sent"
macro index,pager ga "<change-folder>=Archive<enter>" "go to archive"
macro index,pager Ma ";<save-message>=Archive<enter>" "move mail to archive"
macro index,pager Ca ";<copy-message>=Archive<enter>" "copy mail to archive"

#set crypt_autosign = yes #set crypt_autosign = yes
#set crypt_opportunistic_encrypt = yes #set crypt_opportunistic_encrypt = yes
#set pgp_self_encrypt = yes #set pgp_self_encrypt = yes


+ 10
- 0
share/switch.muttrc View File

@@ -0,0 +1,10 @@
# vim: filetype=neomuttrc

# This is an embarrassing and hacky file that unbinds a bunch of binds between
# switching accounts. It is called each time an account is changed.

unset hostname
unmy_hdr Organization
unmailboxes *
unalternates *
unset signature

+ 0
- 37
share/unbind.muttrc View File

@@ -1,37 +0,0 @@
# vim: filetype=neomuttrc

# This is an embarrassing and hacky file that unbinds a bunch of binds between
# switching accounts. It is called each time an account is changed.

bind index,pager gi noop
bind index,pager gs noop
bind index,pager gd noop
bind index,pager ga noop
bind index,pager gS noop
bind index,pager gj noop
bind index,pager gt noop
bind index,pager Mi noop
bind index,pager Ms noop
bind index,pager Md noop
bind index,pager Ma noop
bind index,pager MS noop
bind index,pager Mj noop
bind index,pager Mt noop
bind index,pager Ci noop
bind index,pager Cs noop
bind index,pager Cd noop
bind index,pager Ca noop
bind index,pager CS noop
bind index,pager Cj noop
bind index,pager Ct noop
bind index,pager gg noop
bind index,pager g noop
bind index,pager M noop
bind index,pager C noop
unset hostname
unmy_hdr Organization
unmailboxes *
unalternates *
unset signature

bind index gg first-entry

Loading…
Cancel
Save