diff options
Diffstat (limited to 'notmuch')
-rw-r--r-- | notmuch/.config/afew/config | 11 | ||||
-rw-r--r-- | notmuch/.config/environment.d/20-mail.conf | 1 | ||||
-rw-r--r-- | notmuch/.config/goimapnotify/goimapnotify.conf | 34 | ||||
-rw-r--r-- | notmuch/.config/maildir-rank-addr/config.toml | 2 | ||||
-rw-r--r-- | notmuch/.config/mbsync/mbsyncrc | 59 | ||||
-rw-r--r-- | notmuch/.config/notmuch/default/config | 1 | ||||
-rwxr-xr-x | notmuch/.config/notmuch/default/hooks/post-insert | 7 | ||||
-rwxr-xr-x | notmuch/.config/notmuch/default/hooks/post-new | 4 | ||||
-rwxr-xr-x | notmuch/.config/notmuch/default/hooks/pre-new | 3 | ||||
-rw-r--r-- | notmuch/.config/profile.d/50-notmuch.sh | 3 | ||||
-rw-r--r-- | notmuch/.config/systemd/user/goimapnotify.service | 11 | ||||
-rw-r--r-- | notmuch/.config/systemd/user/notmuch.service | 3 | ||||
-rwxr-xr-x | notmuch/.local/bin/notmuch-notify | 34 | ||||
-rwxr-xr-x | notmuch/install.sh | 2 |
14 files changed, 172 insertions, 3 deletions
diff --git a/notmuch/.config/afew/config b/notmuch/.config/afew/config new file mode 100644 index 0000000..b30b220 --- /dev/null +++ b/notmuch/.config/afew/config @@ -0,0 +1,11 @@ +[SpamFilter] +[KillThreadsFilter] +[ListMailsFilter] +[ArchiveSentMailsFilter] +sent_tag = sent +[Filter.0] +message = notify +query = tag:new +tags_blacklist = killed;spam +tags = +notify +[InboxFilter] diff --git a/notmuch/.config/environment.d/20-mail.conf b/notmuch/.config/environment.d/20-mail.conf new file mode 100644 index 0000000..1c12b82 --- /dev/null +++ b/notmuch/.config/environment.d/20-mail.conf @@ -0,0 +1 @@ +MAIL=$XDG_DATA_HOME/mail/porkbun/INBOX diff --git a/notmuch/.config/goimapnotify/goimapnotify.conf b/notmuch/.config/goimapnotify/goimapnotify.conf new file mode 100644 index 0000000..f1be213 --- /dev/null +++ b/notmuch/.config/goimapnotify/goimapnotify.conf @@ -0,0 +1,34 @@ +[ + { + "host": "imap.porkbun.com", + "port": 993, + "tls": true, + "tlsOptions": { + "reject_unauthorized": false + }, + "username": "tobyv@tobyvin.dev", + "passwordCmd": "pass tobyv@tobyvin.dev | head -n1", + "boxes": [ + { + "mailbox": "INBOX", + "onNewMail": "MAILDIR=porkbun:INBOX notmuch new" + } + ] + }, + { + "host": "imap.gmail.com", + "port": 993, + "tls": true, + "tlsOptions": { + "reject_unauthorized": false + }, + "username": "tobyv13@gmail.com", + "passwordCmd": "pass gmail | head -n1", + "boxes": [ + { + "mailbox": "INBOX", + "onNewMail": "MAILDIR=gmail:INBOX notmuch new" + } + ] + } +] diff --git a/notmuch/.config/maildir-rank-addr/config.toml b/notmuch/.config/maildir-rank-addr/config.toml new file mode 100644 index 0000000..ef2b04a --- /dev/null +++ b/notmuch/.config/maildir-rank-addr/config.toml @@ -0,0 +1,2 @@ +addresses = ["tobyv@tobyvin.dev", "tobyv13@gmail.com", "tovince@siue.edu"] +template = "{{.Address}}\t{{.Name}}\t{{.NormalizedName}}" diff --git a/notmuch/.config/mbsync/mbsyncrc b/notmuch/.config/mbsync/mbsyncrc new file mode 100644 index 0000000..a2501eb --- /dev/null +++ b/notmuch/.config/mbsync/mbsyncrc @@ -0,0 +1,59 @@ +Create Both +Expunge Both +SyncState * + +IMAPAccount porkbun +Host imap.porkbun.com +User tobyv@tobyvin.dev +PassCmd "pass tobyv@tobyvin.dev" +SSLType IMAPS +CertificateFile /etc/ssl/certs/ca-certificates.crt + +IMAPStore porkbun-remote +Account porkbun + +MaildirStore porkbun-local +Path ~/.local/share/mail/porkbun/ +Inbox ~/.local/share/mail/porkbun/INBOX + +Channel porkbun +Far :porkbun-remote: +Near :porkbun-local: +Patterns * + +IMAPAccount gmail +Host imap.gmail.com +User tobyv13@gmail.com +PassCmd "pass gmail" +SSLType IMAPS +CertificateFile /etc/ssl/certs/ca-certificates.crt + +IMAPStore gmail-remote +Account gmail + +MaildirStore gmail-local +Path ~/.local/share/mail/gmail/ +Inbox ~/.local/share/mail/gmail/INBOX + +Channel gmail +Far :gmail-remote: +Near :gmail-local: +Patterns "INBOX" + +Channel gmail-drafts +Far :gmail-remote:"[Gmail]/Drafts" +Near :gmail-local:Drafts + +Channel gmail-sent +Far :gmail-remote:"[Gmail]/Sent Mail" +Near :gmail-local:Sent + +Channel gmail-trash +Far :gmail-remote:"[Gmail]/Trash" +Near :gmail-local:Trash + +Group gmail +Channel gmail +Channel gmail-drafts +Channel gmail-sent +Channel gmail-trash diff --git a/notmuch/.config/notmuch/default/config b/notmuch/.config/notmuch/default/config index b31367a..4a70d0c 100644 --- a/notmuch/.config/notmuch/default/config +++ b/notmuch/.config/notmuch/default/config @@ -5,6 +5,7 @@ name=Toby Vincent primary_email=tobyv@tobyvin.dev other_email=tobyv13@gmail.com;tovince@siue.edu; [new] +tags=new ignore=.mbsyncstate;.uidvalidity;addressbook.tsv; [maildir] synchronize_flags=true diff --git a/notmuch/.config/notmuch/default/hooks/post-insert b/notmuch/.config/notmuch/default/hooks/post-insert new file mode 100755 index 0000000..8651aa4 --- /dev/null +++ b/notmuch/.config/notmuch/default/hooks/post-insert @@ -0,0 +1,7 @@ +#!/bin/sh + +for maildir in ${XDG_DATA_HOME}/mail/${MAILDIR:-*}; do + if [ -e "$maildir"/INBOX ]; then + maildir-rank-addr --maildir="$maildir"/INBOX --outputpath="$maildir"/addressbook.tsv + fi +done diff --git a/notmuch/.config/notmuch/default/hooks/post-new b/notmuch/.config/notmuch/default/hooks/post-new new file mode 100755 index 0000000..3dcc977 --- /dev/null +++ b/notmuch/.config/notmuch/default/hooks/post-new @@ -0,0 +1,4 @@ +#!/bin/sh + +afew -C "$XDG_CONFIG_HOME"/notmuch/default/config --tag --new +~/.local/bin/notmuch-notify diff --git a/notmuch/.config/notmuch/default/hooks/pre-new b/notmuch/.config/notmuch/default/hooks/pre-new new file mode 100755 index 0000000..7ea4a68 --- /dev/null +++ b/notmuch/.config/notmuch/default/hooks/pre-new @@ -0,0 +1,3 @@ +#!/bin/sh + +mbsync -c "$XDG_CONFIG_HOME"/mbsync/mbsyncrc "${MAILDIR:--a}" diff --git a/notmuch/.config/profile.d/50-notmuch.sh b/notmuch/.config/profile.d/50-notmuch.sh new file mode 100644 index 0000000..f6b6d77 --- /dev/null +++ b/notmuch/.config/profile.d/50-notmuch.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +export NOTMUCH_CONFIG="$XDG_CONFIG_HOME"/notmuch/default/config diff --git a/notmuch/.config/systemd/user/goimapnotify.service b/notmuch/.config/systemd/user/goimapnotify.service new file mode 100644 index 0000000..6a76d4d --- /dev/null +++ b/notmuch/.config/systemd/user/goimapnotify.service @@ -0,0 +1,11 @@ +[Unit] +Description=Execute scripts on IMAP mailbox changes (new/deleted/updated messages) using IDLE, golang version. + +[Service] +Type=simple +ExecStart=/usr/bin/goimapnotify +Restart=always +RestartSec=30 + +[Install] +WantedBy=default.target diff --git a/notmuch/.config/systemd/user/notmuch.service b/notmuch/.config/systemd/user/notmuch.service index fcbee89..865b3fd 100644 --- a/notmuch/.config/systemd/user/notmuch.service +++ b/notmuch/.config/systemd/user/notmuch.service @@ -1,11 +1,10 @@ [Unit] Description=Mailbox indexer service Documentation=man:notmuch(1) -After=mbsync@.service [Service] Type=oneshot ExecStart=/usr/bin/notmuch new [Install] -WantedBy=mbsync@.service +WantedBy=default.target diff --git a/notmuch/.local/bin/notmuch-notify b/notmuch/.local/bin/notmuch-notify new file mode 100755 index 0000000..f808c4d --- /dev/null +++ b/notmuch/.local/bin/notmuch-notify @@ -0,0 +1,34 @@ +#!/bin/python + +import notmuch +import subprocess +import os + + +def notify(title, message): + subprocess.Popen( + [ + "notify-send", + "--app-name=notmuch-notify", + "--category=email.arrived", + "--icon=mail-unread", + title, + message, + ] + ) + + +for message in ( + notmuch.Database( + path="{}/mail".format( + os.getenv("XDG_DATA_HOME", os.path.expanduser("~/.local/share")) + ), + mode=notmuch.Database.MODE.READ_WRITE, + ) + .create_query("tag:notify") + .search_messages() +): + print(message) + message.remove_tag("notify") + notify(message.get_header("From"), message.get_header("Subject")) + del message diff --git a/notmuch/install.sh b/notmuch/install.sh index 7eafdb4..4064150 100755 --- a/notmuch/install.sh +++ b/notmuch/install.sh @@ -9,4 +9,4 @@ fi printf "%s: Installing service\n" "$0" -systemctl --user enable --now --no-block $pkgname.service +systemctl --user enable --now --no-block notmuch.service goimapnotify.service |