add mutt-multi-account-setup
authorMart Lubbers <mart@martlubbers.net>
Mon, 1 Jul 2024 14:18:34 +0000 (16:18 +0200)
committerMart Lubbers <mart@martlubbers.net>
Mon, 1 Jul 2024 18:43:36 +0000 (20:43 +0200)
config.h/slstatus/config.h
email/.config/mutt/common.muttrc [new file with mode: 0644]
email/.config/mutt/muttrc
email/.config/mutt/net.muttrc [new file with mode: 0644]
email/.config/mutt/ru.muttrc [new file with mode: 0644]
email/.config/notmuch/config
email/.config/offlineimap/config
email/.config/offlineimap/offlineimap.py
shell/.local/bin/tmuxmail
shell/.local/bin/update

index dde9da5..f3a8ca6 100644 (file)
@@ -66,8 +66,10 @@ static const struct arg args[] = {
        /* function format          argument */
        { temp,          " ðŸŒ¡ %s°C | ",
                "/sys/class/thermal/thermal_zone1/temp"},
-       { num_files,     "✉ %s | ",
-               "/home/mrl/.local/share/offlineimap/mail/INBOX/new" },
+       { num_files,     "N✉ %s | ",
+               "/home/mrl/.local/share/offlineimap/mail/net/INBOX/new" },
+       { num_files,     "R✉ %s | ",
+               "/home/mrl/.local/share/offlineimap/mail/ru/INBOX/new" },
        { keymap,        "%s | ",          NULL },
 #ifdef LAPTOP
 //     { wifi_essid,    "W %s ",          "wlp1s0" },
diff --git a/email/.config/mutt/common.muttrc b/email/.config/mutt/common.muttrc
new file mode 100644 (file)
index 0000000..4b40f4b
--- /dev/null
@@ -0,0 +1,2 @@
+set spoolfile=+/INBOX/
+set postponed=+/Drafts/
index f3b77de..714ecd2 100644 (file)
@@ -1,14 +1,12 @@
+# source net on first open
+source ~/.config/mutt/net.muttrc
+
 # Basic information
-set from="Mart Lubbers <mart@martlubbers.net>"
 alternates "(mart@cs\.ru\.nl|m\.lubbers@cs\.ru\.nl|mart@martlubbers\.net|Mart\.Lubbers@ru\.nl)"
 set use_from=yes
 set reverse_name=yes
 set envelope_from=yes
 set mbox_type=Maildir
-set folder=~/.local/share/offlineimap/mail
-set spoolfile=+/INBOX/
-set record=+/Sent/
-set postponed=+/Drafts/
 set mask="!^\\.[^.]"
 source ~/.local/share/offlineimap/mailboxes
 
@@ -25,15 +23,23 @@ set print_command='set -e; f=`mktemp -p "$HOME"/.cache/mutt`; \
 # Set the correct msmtp account for the different addresses
 send2-hook '~f mart@martlubbers.net'\
        'set sendmail="checkattach.sh msmtp -a net"'
-send2-hook '((~f m.lubbers@cs.ru.nl)|(~f m.lubbers@science.ru.nl)|(~f mart@cs.ru.nl)|(~f m.lubbers@cs.ru.nl))'\
+send2-hook '((~f m.lubbers@cs.ru.nl)|(~f m.lubbers@science.ru.nl)|(~f mart@cs.ru.nl))'\
+       'set sendmail="checkattach.sh msmtp -a ru"'
+send2-hook '((~f mart.lubbers@ru.nl))'\
        'set sendmail="checkattach.sh msmtp -a ru"'
 
 # Macro for switching to the ru address
 alias identity_1         Mart Lubbers <mart@martlubbers.net>
 alias identity_2         Mart Lubbers <mart@cs.ru.nl>
 macro compose v "<edit-from>^Uidentity\_<tab>" "Select from"
-macro compose <esc>1 "<esc>f^UMart Lubbers <mart@martlubbers.net><enter>"
-macro compose <esc>2 "<esc>f^UMart Lubbers <mart@cs.ru.nl><enter>"
+macro compose <esc>1 "<esc>f^UMart Lubbers <mart@martlubbers.net><enter>ps"
+macro compose <esc>2 "<esc>f^UMart Lubbers <mart@cs.ru.nl><enter>ps"
+macro compose <esc>3 "<esc>f^UMart Lubbers <mart.lubbers@ru.nl><enter>pc"
+
+macro index,compose <esc>1 "<enter-command>source ~/.config/mutt/net.muttrc<enter><change-folder>=INBOX<enter>"
+macro index,compose <esc>2 "<enter-command>source ~/.config/mutt/ru.muttrc<enter><change-folder>=INBOX<enter>"
+folder-hook ~/.local/share/offlineimap/mail/net/* 'source ~/.config/mutt/net.muttrc'
+folder-hook ~/.local/share/offlineimap/mail/ru/* 'source ~/.config/mutt/ru.muttrc'
 
 # Key bindings
 bind index gg first-entry
@@ -47,6 +53,7 @@ bind index,pager F flag-message
 
 # Misc options
 set timeout=2
+set sleep_time=0
 set mail_check=0
 set include=yes
 set delete=yes
@@ -59,13 +66,12 @@ unset markers
 set sort_browser=alpha
 set sort=threads
 set sort_aux=date
-set editor="vim -c '%!proofpoint_decoder'"
+set editor="vim -c '%'"
 set duplicate_threads=yes
 ignore headers *
 unignore headers from to subject date cc
 set mailcap_path=~/.config/mutt/mailcap
 set mailcap_sanitize=yes
-set display_filter="proofpoint_decoder"
 
 # w3m --dump
 auto_view text/html
diff --git a/email/.config/mutt/net.muttrc b/email/.config/mutt/net.muttrc
new file mode 100644 (file)
index 0000000..e6c7db5
--- /dev/null
@@ -0,0 +1,6 @@
+set from="Mart Lubbers <mart@martlubbers.net>"
+set folder=~/.local/share/offlineimap/mail/net
+set record=+/Sent/
+
+# reload common things that depend on $folder
+source ~/.config/mutt/common.muttrc
diff --git a/email/.config/mutt/ru.muttrc b/email/.config/mutt/ru.muttrc
new file mode 100644 (file)
index 0000000..fdcb43d
--- /dev/null
@@ -0,0 +1,6 @@
+set from="Mart Lubbers <mart@cs.ru.nl>"
+set folder=~/.local/share/offlineimap/mail/ru
+set record=+/INBOX.Sent/
+
+# reload common things that depend on $folder
+source ~/.config/mutt/common.muttrc
index f104340..2fcb22c 100644 (file)
@@ -31,7 +31,7 @@ path=/home/mrl/.local/share/offlineimap/mail
 [user]
 name=Mart Lubbers
 primary_email=mart@martlubbers.net
-other_email=martlubbers@gmail.com,mart-lubbers@hotmail.com,mail@rooslubbers.nl,mart@cs.ru.nl
+other_email=martlubbers@gmail.com,mart-lubbers@hotmail.com,mail@rooslubbers.nl,mart@cs.ru.nl,mart.lubbers@ru.nl,mlubbers@cs.ru.nl
 
 # Configuration for "notmuch new"
 #
index 42d5b4b..47be912 100644 (file)
@@ -1,25 +1,44 @@
 [general]
-pythonfile = ~/.config/offlineimap/offlineimap.py
 metadata = ~/.local/share/offlineimap
-accounts = net
+accounts = net,ru
 ui = blinkenlights
+pythonfile = ~/.config/offlineimap/offlineimap.py
+
+[mbnames]
+enabled = yes
+filename = ~/.local/share/offlineimap/mailboxes
+header = "mailboxes "
+peritem = "~/.local/share/offlineimap/mail/%(accountname)s/%(foldername)s/"
+sep = " "
+footer = "\n"
+incremental = yes
 
 [Account net]
-localrepository = Local
-remoterepository = Remote
+localrepository = netLocal
+remoterepository = netRemote
 autorefresh = 6
 quick = 10
 postsynchook = newmail.sh
-#proxy = SOCKS5:localhost:8008
 
-[Repository Local]
+[Account ru]
+localrepository = ruLocal
+remoterepository = ruRemote
+autorefresh = 6
+quick = 10
+postsynchook = newmail.sh
+
+[Repository netLocal]
 type = Maildir
-localfolders = ~/.local/share/offlineimap/mail
+localfolders = ~/.local/share/offlineimap/mail/net
 
-[Repository Remote]
+[Repository ruLocal]
+type = Maildir
+localfolders = ~/.local/share/offlineimap/mail/ru
+
+[Repository netRemote]
 type = IMAP
 folderfilter = lambda x: folderfilter(x)
-remotepasseval = mailpasswd()
+remotepasseval = mailpasswdnet()
 remotehost = lubbers.email
 remoteuser = mart@martlubbers.net
 ssl = yes
@@ -28,11 +47,13 @@ keepalive = 60
 holdconnectionopen = yes
 idlefolders = ['INBOX']
 
-[mbnames]
-enabled = yes
-filename = ~/.local/share/offlineimap/mailboxes
-header = "mailboxes "
-peritem = "~/.local/share/offlineimap/mail/%(foldername)s/"
-sep = " "
-footer = "\n"
-incremental = yes
+[Repository ruRemote]
+type = IMAP
+remotepasseval = mailpasswdru()
+remotehost = post.science.ru.nl
+remoteuser = mlubbers
+ssl = yes
+sslcacertfile = /etc/ssl/certs/ca-certificates.crt
+keepalive = 60
+holdconnectionopen = yes
+idlefolders = ['INBOX']
index 1a4bf03..c2fcee0 100644 (file)
@@ -3,10 +3,12 @@ import datetime
 import re
 
 
-def mailpasswd():
+def mailpasswdnet():
     return subprocess.check_output('pass mail/mart@martlubbers.net',
                                    shell='/bin/bash').strip()
-
+def mailpasswdru():
+    return subprocess.check_output('pass science.ru.nl/mlubbers',
+                                   shell='/bin/bash').strip()
 
 def folderfilter(x):
     match = re.match('archive\.(\d\d\d\d).(\d\d)', x)
index a0ff713..50d4ad0 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/sh
 tmux -f ~/.config/tmux/config\
-       new-session -s mail -d 'update && offlineimap' \;\
-       new-window 'mutt'                              \;\
-       new-window 'ssh ygdrassil'                     \;\
-       new-session -s work                            \;\
-       attach-session -t mail                         \;\
+       new-session -s mail -d 'offlineimap -a net' \;\
+       split-window -h 'offlineimap -a ru'         \;\
+       split-window -v 'update'                    \;\
+       new-window 'mutt'                           \;\
+       new-session -s work                         \;\
+       attach-session -t mail                      \;\
        select-window -t:1
 exec tmux attach
index 127959f..0321d45 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 NUL=">/dev/null 2>&1"
 
-offlineimap -o -u ttyui
 vdirsyncer sync
 
 cmd() {