diff options
-rwxr-xr-x | bin/mailsync | 13 | ||||
-rwxr-xr-x | bin/mw | 4 | ||||
-rw-r--r-- | share/mutt-wizard.muttrc | 5 |
3 files changed, 13 insertions, 9 deletions
diff --git a/bin/mailsync b/bin/mailsync index 202d9be..d79507d 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -1,17 +1,20 @@ #!/usr/bin/env sh # Sync mail and give notification if there is new mail. +export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +export DISPLAY=:0.0 +[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" + # Run only if user logged in (prevent cron errors) -pgrep -u "$USER" >/dev/null || exit +pgrep -u "$USER" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pgrep -x mbsync >/dev/null && exit +pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} # Checks for internet connection and set notification script. -ping -q -c 1 1.1.1.1 > /dev/null || exit +ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; exit ;} command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script." -export DISPLAY=:0.0 - # Settings are different for MacOS (Darwin) systems. if [ "$(uname)" = "Darwin" ]; then notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} @@ -26,7 +26,7 @@ muttrc="$muttdir/muttrc" msmtprc="$HOME/.config/msmtp/config" ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail -for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" +for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" do [ -f "$x" ] && sslcert="$x" && break done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1 ;} @@ -194,7 +194,7 @@ EOF } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" - fingerprint="$(msmtp --serverinfo --tls --tls-certcheck=off -a "$title")" || return 1 + fingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off)" || return 1 sed -ibu "s/account $title/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu } diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 1ca0503..ad4d2fe 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -4,7 +4,6 @@ # In the interest of seamless updating, do not edit this file. # If you want to override any settings, set those in your muttrc. set mailcap_path = /usr/share/mutt-wizard/mailcap -set certificate_file = ~/.cache/mutt-wizard/certificates set date_format="%y/%m/%d %I:%M%p" set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" set sort = 'reverse-date' @@ -45,7 +44,9 @@ bind index U undelete-message bind index L limit bind index h noop bind index l display-message -bind browser h goto-parent +#bind browser h goto-parent +macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" +bind index,pager H view-raw-message bind browser l select-entry bind pager,browser gg top-page bind pager,browser G bottom-page |