diff options
-rw-r--r-- | autoconf/mutt_profile | 2 | ||||
-rwxr-xr-x | etc/mailsync.sh | 8 | ||||
-rwxr-xr-x | mutt-wizard.sh | 7 | ||||
-rw-r--r-- | muttrc | 7 |
4 files changed, 14 insertions, 10 deletions
diff --git a/autoconf/mutt_profile b/autoconf/mutt_profile index b34b5f9..31fe22a 100644 --- a/autoconf/mutt_profile +++ b/autoconf/mutt_profile @@ -13,6 +13,8 @@ source "~/.config/mutt/credentials/getmuttpass $title |" set mbox_type = Maildir set ssl_starttls = yes set ssl_force_tls = yes +set spoolfile = "+INBOX" +macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox." bind index,pager gg noop bind index,pager g noop diff --git a/etc/mailsync.sh b/etc/mailsync.sh index 2ac78d9..9f6f3c6 100755 --- a/etc/mailsync.sh +++ b/etc/mailsync.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # This script will run offlineimap and check # for new email if there is an internet connection. # @@ -20,8 +20,13 @@ else notify() { pgrep -x dunst && notify-send -i ~/.config/mutt/etc/email.gif "$2 new mail(s) in \`$1\` account." ;} fi +echo 🔃 > ~/.config/mutt/.dl +pkill -RTMIN+12 i3blocks + # Run offlineimap. You can feed this script different settings. offlineimap -o "$@" +rm -f ~/.config/mutt/.dl +pkill -RTMIN+12 i3blocks # Check all accounts/mailboxes for new mail. Notify if there is new content. for account in $(ls ~/.mail) @@ -32,7 +37,6 @@ do then notify "$account" "$newcount" & disown mpv --quiet ~/.config/mutt/etc/notify.opus - pkill -RTMIN+12 i3blocks # For my i3blocks setup. Updates new mail counter. fi done diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 23ae7ab..a81c83c 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -20,7 +20,7 @@ chooseSync() { (cat /var/run/crond.pid && testSync) || dialog --msgbox "No cron testSync() { (crontab -l | grep .config/mutt/etc/mailsync && removeSync) || addSync ;} addSync() { min=$(dialog --inputbox "How many minutes should be between mail syncs?" 8 60 3>&1 1>&2 2>&3 3>&-) - (crontab -l; echo "*/$min * * * * $HOME/.config/mutt/etc/mailsync.sh") | crontab - && + (crontab -l; echo "*/$min * * * * export DISPLAY=:0.0 && $HOME/.config/mutt/etc/mailsync.sh") | crontab - && dialog --msgbox "Cronjob successfully added. Remember you may need to restart or tell systemd/etc. to start your cron manager for this to take effect." 7 60 ;} removeSync() { ((crontab -l | sed -e '/.config\/mutt\/etc\/mailsync/d') | crontab - >/dev/null) && dialog --msgbox "Cronjob successfully removed. To reactivate, select this option again." 6 60 ;} @@ -79,20 +79,17 @@ detectMailboxes() { \ delim=$(gen_delim $sidebar_width) oneline=$(cat /tmp/$1_boxes | sed -e "s/^\|$/\"/g" | tr "\n" " ") oneline="=$1 $delim $oneline" - sed -i "/^mailboxes\|^set spoolfile\|^set record\|^set postponed/d" "$muttdir"accounts/$1.muttrc + sed -i "/^mailboxes\|^set record\|^set postponed/d" "$muttdir"accounts/$1.muttrc echo mailboxes $oneline >> "$muttdir"accounts/$1.muttrc sed -i "/^macro index,pager g/d" "$muttdir"accounts/$1.muttrc - grep -vi /tmp/$1_boxes -e "trash\|drafts\|sent\|trash\|spam\|junk\|archive\|chat\|old\|new\|gmail\|sms\|call" | sort -n | sed 1q | formatShortcut i inbox $1 grep -i /tmp/$1_boxes -e sent | sed 1q | formatShortcut s sent $1 grep -i /tmp/$1_boxes -e draft | sed 1q | formatShortcut d drafts $1 grep -i /tmp/$1_boxes -e trash | sed 1q | formatShortcut t trash $1 grep -i /tmp/$1_boxes -e spam | sed 1q | formatShortcut S spam $1 grep -i /tmp/$1_boxes -e archive | sed 1q | formatShortcut a archive $1 - spoolfile=$(grep -vi /tmp/$1_boxes -e "trash\|drafts\|sent\|trash\|spam\|ham\|junk\|archive\|chat\|old\|new\|gmail\|sms\|call" | sort -n | sed 1q | sed -e 's/=/+/g') record=$(grep -i /tmp/$1_boxes -e sent | sed -e 's/=/+/g' | sed 1q) postponed=$(grep -i /tmp/$1_boxes -e draft | sed -e 's/=/+/g' | sed 1q) trash=$(grep -i /tmp/$1_boxes -e trash | sed -e 's/=/+/g' | sed 1q) - echo "set spoolfile = \"$spoolfile\"" >> "$muttdir"accounts/$1.muttrc echo "set record = \"$record\"" >> "$muttdir"accounts/$1.muttrc echo "set postponed = \"$postponed\"" >> "$muttdir"accounts/$1.muttrc echo "set trash = \"$trash\"" >> "$muttdir"accounts/$1.muttrc ;} @@ -18,6 +18,7 @@ set markers = no set mark_old = no set mime_forward = yes set smtp_authenticators = 'gssapi:login' +set wait_key = no auto_view text/html auto_view application/pdf alternative_order text/plain text/enriched text/html @@ -37,7 +38,7 @@ bind index D delete-message bind index U undelete-message bind index F search bind index,pager R group-reply -macro index,pager S '<sync-mailbox> +macro index,pager S '<sync-mailbox><shell-escape>pkill -RTMIN+12 i3blocks<enter>' macro index,pager \Cu |urlview\n # View attachments properly. @@ -55,8 +56,8 @@ set include # include message in replies macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" #sync email -macro index O "<shell-escape>offlineimap<enter>" "run offlineimap to sync all mail" -macro index o "<shell-escape>offlineimap -qf INBOX<enter>" "run offlineimap to sync inbox" +macro index O "<shell-escape>$HOME/.config/mutt/etc/mailsync.sh<enter>" "run offlineimap to sync all mail" +macro index o "<shell-escape>$HOME/.config/mutt/etc/mailsync.sh -qf INBOX<enter>" "run offlineimap to sync inbox" #copy/move dialogs macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox" |