From: Mart Lubbers Date: Mon, 1 Jul 2024 14:18:34 +0000 (+0200) Subject: add mutt-multi-account-setup X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=57600e32012ce55c030a1db99d6d3f9e2c772e04;p=dotfiles.git add mutt-multi-account-setup --- diff --git a/config.h/slstatus/config.h b/config.h/slstatus/config.h index dde9da5..f3a8ca6 100644 --- a/config.h/slstatus/config.h +++ b/config.h/slstatus/config.h @@ -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 index 0000000..4b40f4b --- /dev/null +++ b/email/.config/mutt/common.muttrc @@ -0,0 +1,2 @@ +set spoolfile=+/INBOX/ +set postponed=+/Drafts/ diff --git a/email/.config/mutt/muttrc b/email/.config/mutt/muttrc index f3b77de..714ecd2 100644 --- a/email/.config/mutt/muttrc +++ b/email/.config/mutt/muttrc @@ -1,14 +1,12 @@ +# source net on first open +source ~/.config/mutt/net.muttrc + # Basic information -set from="Mart Lubbers " 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 alias identity_2 Mart Lubbers macro compose v "^Uidentity\_" "Select from" -macro compose 1 "f^UMart Lubbers " -macro compose 2 "f^UMart Lubbers " +macro compose 1 "f^UMart Lubbers ps" +macro compose 2 "f^UMart Lubbers ps" +macro compose 3 "f^UMart Lubbers pc" + +macro index,compose 1 "source ~/.config/mutt/net.muttrc=INBOX" +macro index,compose 2 "source ~/.config/mutt/ru.muttrc=INBOX" +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 index 0000000..e6c7db5 --- /dev/null +++ b/email/.config/mutt/net.muttrc @@ -0,0 +1,6 @@ +set from="Mart Lubbers " +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 index 0000000..fdcb43d --- /dev/null +++ b/email/.config/mutt/ru.muttrc @@ -0,0 +1,6 @@ +set from="Mart Lubbers " +set folder=~/.local/share/offlineimap/mail/ru +set record=+/INBOX.Sent/ + +# reload common things that depend on $folder +source ~/.config/mutt/common.muttrc diff --git a/email/.config/notmuch/config b/email/.config/notmuch/config index f104340..2fcb22c 100644 --- a/email/.config/notmuch/config +++ b/email/.config/notmuch/config @@ -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" # diff --git a/email/.config/offlineimap/config b/email/.config/offlineimap/config index 42d5b4b..47be912 100644 --- a/email/.config/offlineimap/config +++ b/email/.config/offlineimap/config @@ -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'] diff --git a/email/.config/offlineimap/offlineimap.py b/email/.config/offlineimap/offlineimap.py index 1a4bf03..c2fcee0 100644 --- a/email/.config/offlineimap/offlineimap.py +++ b/email/.config/offlineimap/offlineimap.py @@ -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) diff --git a/shell/.local/bin/tmuxmail b/shell/.local/bin/tmuxmail index a0ff713..50d4ad0 100755 --- a/shell/.local/bin/tmuxmail +++ b/shell/.local/bin/tmuxmail @@ -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 diff --git a/shell/.local/bin/update b/shell/.local/bin/update index 127959f..0321d45 100755 --- a/shell/.local/bin/update +++ b/shell/.local/bin/update @@ -1,7 +1,6 @@ #!/bin/sh NUL=">/dev/null 2>&1" -offlineimap -o -u ttyui vdirsyncer sync cmd() {