diff --git a/imapfilter/.imapfilter/config.lua b/imapfilter/.imapfilter/config.lua index 8e2cfaf..467e093 100644 --- a/imapfilter/.imapfilter/config.lua +++ b/imapfilter/.imapfilter/config.lua @@ -1,4 +1,21 @@ function main() + local fastmail = IMAP { + server = 'imap.fastmail.com', + username = 'maitysanchayan@fastmail.com', + password = get_pwd_fastmail(), + ssl = 'tls1', + } + + fastmail.INBOX:check_status() + mails = fastmail.INBOX:select_all() + move_mailing_lists(fastmail, mails) + mails = fastmail.Sent:select_all() + move_mailing_lists(fastmail, mails) + mails = fastmail['Trash']:select_all() + move_mailing_lists(fastmail, mails) + mails = fastmail['Spam']:select_all() + move_mailing_lists(fastmail, mails) + local sanchayan = IMAP { server = 'imap.gmail.com', username = 'maitysanchayan@gmail.com', @@ -19,28 +36,6 @@ function main() delete_from_trash(sanchayan, mails) mails = sanchayan['[Gmail]/Spam']:select_all() move_mailing_lists(sanchayan, mails) - - local asymptotic = IMAP { - server = 'imap.gmail.com', - username = 'sanchayan@asymptotic.io', - password = get_pwd_asymptotic(), - ssl = 'tls1', - } - - asymptotic.INBOX:check_status() - -- asymptotic['[Gmail]/Trash']:check_status() - -- asymptotic['[Gmail]/Spam']:check_status() - mails = asymptotic.INBOX:select_all() - move_mailing_lists(asymptotic, mails) - mails = asymptotic.Sent:select_all() - move_mailing_lists(asymptotic, mails) - mails = asymptotic['[Gmail]/Trash']:select_all() - imap_trash = asymptotic['Trash']:select_all() - move_to_gmail_trash(asymptotic, imap_trash, '[Gmail]/Trash') - delete_from_trash(asymptotic, mails) - mails = asymptotic['[Gmail]/Spam']:select_all() - move_mailing_lists(asymptotic, mails) - end function move_mailing_lists(account, mails) @@ -128,6 +123,14 @@ function get_imap_password(file) return str; end +function get_pwd_fastmail() + local cmd = "gpg2 --use-agent --quiet --batch --decrypt ~/.fastmail.gpg" + local fd = io.popen(cmd, 'r') + pass = fd:read("*a") + fd:close() + return pass; +end + function get_pwd_sanchayan() local cmd = "gpg2 --use-agent --quiet --batch --decrypt ~/.sanchayan.gpg" local fd = io.popen(cmd, 'r') @@ -136,12 +139,4 @@ function get_pwd_sanchayan() return pass; end -function get_pwd_asymptotic() - local cmd = "gpg2 --use-agent --quiet --batch --decrypt ~/.asymptotic.gpg" - local fd = io.popen(cmd, 'r') - pass = fd:read("*a") - fd:close() - return pass; -end - main() -- Call the main function diff --git a/mbsync/.mbsyncrc b/mbsync/.mbsyncrc index 2440d8b..1fcd083 100644 --- a/mbsync/.mbsyncrc +++ b/mbsync/.mbsyncrc @@ -2,6 +2,32 @@ Create Slave Expunge Both SyncState * +IMAPAccount fastmail +Host imap.fastmail.com +Port 993 +User maitysanchayan@fastmail.com +PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.fastmail.gpg" +SSLType IMAPS +CertificateFile /etc/ssl/certs/ca-certificates.crt + +IMAPStore fastmail-remote +Account fastmail + +MaildirStore fastmail-local +SubFolders Verbatim +Path "~/Mail/fastmail/" +Inbox "~/Mail/fastmail/Inbox" + +Channel fastmail +Master :fastmail-remote: +Slave :fastmail-local: +Patterns * +Expunge None +CopyArrivalDate yes +Sync All +Create Slave +SyncState * + IMAPAccount asymptotic Host imap.gmail.com Port 993 @@ -15,8 +41,8 @@ Account asymptotic MaildirStore asymptotic-local SubFolders Verbatim -Path "~/Gmail/asymptotic/" -Inbox "~/Gmail/asymptotic/Inbox" +Path "~/Mail/asymptotic/" +Inbox "~/Mail/asymptotic/Inbox" Channel asymptotic Master :asymptotic-remote: @@ -35,8 +61,8 @@ Account gmail MaildirStore gmail-local Subfolders Verbatim -Path "~/Gmail/sanchayan/" -Inbox "~/Gmail/sanchayan/Inbox" +Path "~/Mail/sanchayan/" +Inbox "~/Mail/sanchayan/Inbox" Channel gmail Master :gmail-remote: diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc index 675593e..4b67cd7 100644 --- a/msmtp/.msmtprc +++ b/msmtp/.msmtprc @@ -7,6 +7,12 @@ auth on tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt +account fastmail +host smtp.fastmail.com +from sanchayan@sanchayanmaity.net +user maitysanchayan@fastmail.com +passwordeval "gpg2 --use-agent --batch --quiet --no-greeting --no-tty --for-your-eyes-only --homedir /home/core/.gnupg --decrypt ~/.fastmail.gpg" + account Sanchayan host smtp.gmail.com from maitysanchayan@gmail.com @@ -20,4 +26,4 @@ user sanchayan@asymptotic.io passwordeval "gpg2 --use-agent --batch --quiet --no-greeting --no-tty --for-your-eyes-only --homedir /home/core/.gnupg --decrypt ~/.asymptotic.gpg" # Set a default account -account default : Sanchayan +account default : fastmail diff --git a/mutt/.mutt/accounts/fastmail b/mutt/.mutt/accounts/fastmail new file mode 100644 index 0000000..d7ad1da --- /dev/null +++ b/mutt/.mutt/accounts/fastmail @@ -0,0 +1,21 @@ +set from = "sanchayan@sanchayanmaity.net" +set sendmail = "/usr/bin/msmtp -a fastmail" +set mbox = "+fastmail/Archive" +set postponed = "+fastmail/drafts" +set record = "+fastmail/Sent" + +color status green default + +macro index D \ + "+fastmail/Trash" \ + "move message to the trash" + +macro index S \ + "+fastmail/Spam" \ + "mark message as spam" + +macro index gi "=fastmail/Inbox" "Go to Inbox" +macro index gf "=fastmail/FreedesktopGitlab" "Go to freedesktop gitlab" +macro index gg "=fastmail/gstreamer" "Go to gstreamer" +macro index gp "=fastmail/pulseaudio" "Go to pulseaudio" +macro index gs "=fastmail/Sent" "Go to Sent" diff --git a/mutt/.mutt/accounts/sanchayan b/mutt/.mutt/accounts/sanchayan index fc258ce..d8a2a90 100644 --- a/mutt/.mutt/accounts/sanchayan +++ b/mutt/.mutt/accounts/sanchayan @@ -13,3 +13,9 @@ macro index D \ macro index S \ "+sanchayan/Spam" \ "mark message as spam" + +macro index gi "=sanchayan/Inbox" "Go to Inbox" +macro index gf "=sanchayan/FreedesktopGitlab" "Go to freedesktop gitlab" +macro index gg "=sanchayan/gstreamer" "Go to gstreamer" +macro index gp "=sanchayan/pulseaudio" "Go to pulseaudio" +macro index gs "=sanchayan/Sent" "Go to Sent" diff --git a/mutt/.mutt/mailnotify.sh b/mutt/.mutt/mailnotify.sh index a5de21d..cc5f1fa 100755 --- a/mutt/.mutt/mailnotify.sh +++ b/mutt/.mutt/mailnotify.sh @@ -1,17 +1,31 @@ #!/bin/bash -imapfilter -c ~/.imapfilter/config.lua -mbsync -a -notmuch new - export DISPLAY=:0 -let inbox=`ls /home/core/Gmail/sanchayan/Inbox/new/|wc -l` -let asymptotic_inbox=`ls /home/core/Gmail/asymptotic/Inbox/new/|wc -l` -if [ "$inbox" -gt 0 ]; then - sudo -u core DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "You have $inbox new mails in inbox" +imapfilter -c ~/.imapfilter/config.lua + +if [ -d "$HOME/Mail/fastmail" ]; then + mbsync fastmail + fastmail_inbox=$(find ~/Mail/fastmail/Inbox/new | wc -l) + if [ "$fastmail_inbox" -gt 1 ]; then + notify-send "You have $fastmail_inbox new mails in fastmail inbox" + fi fi -if [ "$asymptotic_inbox" -gt 0 ]; then - sudo -u core DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "You have $asymptotic_inbox new mails in asymptotic inbox" +if [ -d "$HOME/Mail/sanchayan" ]; then + mbsync gmail + gmail_inbox=$(find ~/Mail/sanchayan/Inbox/new | wc -l) + if [ "$gmail_inbox" -gt 1 ]; then + notify-send "You have $gmail_inbox new mails in gmail inbox" + fi fi + +if [ -d "$HOME/Mail/asymptotic" ]; then + mbsync asymptotic + asymptotic_inbox=$(find ~/Mail/asymptotic/Inbox/new | wc -l) + if [ "$asymptotic_inbox" -gt 1 ]; then + notify-send "You have $asymptotic_inbox new mails in asymptotic inbox" + fi +fi + +notmuch new diff --git a/mutt/.mutt/muttrc b/mutt/.mutt/muttrc index 11aecc5..ff8e003 100644 --- a/mutt/.mutt/muttrc +++ b/mutt/.mutt/muttrc @@ -1,11 +1,13 @@ set mbox_type = Maildir -set folder = ~/Gmail -set spoolfile = +/sanchayan/Inbox -set header_cache=~/Gmail/mutt_cache/ # a much faster opening of mailboxes... +set folder = ~/Mail +set spoolfile = +/fastmail/Inbox +set header_cache=~/Mail/mutt_cache/ # a much faster opening of mailboxes... +source ~/.mutt/accounts/fastmail source ~/.mutt/accounts/sanchayan source ~/.mutt/accounts/asymptotic +folder-hook fastmail/* source ~/.mutt/accounts/fastmail folder-hook sanchayan/* source ~/.mutt/accounts/sanchayan folder-hook asymptotic/* source ~/.mutt/accounts/asymptotic @@ -32,7 +34,7 @@ set smart_wrap set tilde unset markers -# composing +# composing set fcc_attach unset mime_forward set forward_format = "Fwd: %s" @@ -44,7 +46,6 @@ unignore from: to: cc: date: subject: # then, show only these hdr_order from: to: cc: date: subject: # and in this order source ~/.mutt/gruvbox.muttrc -macro index 'c' '?^K=' set send_charset="us-ascii:utf-8" set send_charset="utf-8" @@ -75,4 +76,19 @@ macro index L "unset wait_keyread -p 'notmuc # 'a' shows all messages again (supersedes default binding) macro index a "all\n" "show all messages (undo limit)" -# macro index D "+/Trash" "Move message to the trash" +macro index C '?^K=' +macro index ca 'source ~/.mutt/muttrc/accounts/asymptotic=asymptotic/Inbox/' +macro index cf 'source ~/.mutt/muttrc/accounts/fastmail=fastmail/Inbox/' +macro index cg 'source ~/.mutt/muttrc/accounts/sanchayan=sanchayan/Inbox/' + +macro index ,so "l ^a^k^O\n" "show old messages only" +macro index ,sn "l ^a^k~N\n" "show unread/new only" +macro index ,sf "l ~F\n" "show flagged messages only" +macro index ,si "l (~n5-100|~N)\n" "show higher scoring messages" +macro index ,hl "l ^a^k!~l\n" "hide list messages" +macro index ,sa "l ^a^kall\n" "show all messages" + +bind pager \Cp previous-line +bind pager \Cn next-line +bind pager previous-line +bind pager next-line diff --git a/notmuch/.notmuch-config b/notmuch/.notmuch-config index 4c114e9..54f21ec 100644 --- a/notmuch/.notmuch-config +++ b/notmuch/.notmuch-config @@ -11,7 +11,7 @@ # configured here named ".notmuch". # [database] -path=/home/core/Gmail +path=/home/core/Mail # User configuration # @@ -30,8 +30,8 @@ path=/home/core/Gmail # [user] name=Sanchayan Maity -primary_email=sanchayan@asymptotic.io -other_email=maitysanchayan@gmail.com; +primary_email=maitysanchayan@fastmail.com +other_email=maitysanchayan@gmail.com;sanchayan@asymptotic.io # Configuration for "notmuch new" # @@ -49,7 +49,7 @@ other_email=maitysanchayan@gmail.com; # [new] tags=N; -ignore=mutt_cache +ignore=mutt_cache;.mbsyncstate;.mbsyncstate.lock;.uidvalidity # Search configuration #