diff options
author | Luke Smith <luke@lukesmith.xyz> | 2022-10-07 12:08:38 -0400 |
---|---|---|
committer | Luke Smith <luke@lukesmith.xyz> | 2022-10-07 12:08:38 -0400 |
commit | 11a0e879a28d010221392f8244c4883d02698893 (patch) | |
tree | 0f307fe6b3472d08ae8d3e41196edc4a3d710407 /bin | |
parent | 3fe9922ec3112c5a1dafdb6af355c08cb8353e36 (diff) | |
parent | 1946ff8aa1dcfcec84d61389584476af7588fa12 (diff) |
Merge branch 'nonnotifyoption' of https://github.com/insanerwayner/mutt-wizard into insanerwayner-nonnotifyoption
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mailsync | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/mailsync b/bin/mailsync index 1dc3d47..801aaeb 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -19,7 +19,7 @@ pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # files for variable assignments. This is ugly, but there are few options that # will work on the maximum number of machines. eval "$(grep -h -- \ - "^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ + "^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\|MAILSYNC_MUTE\)=" \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ "$HOME/.pam_environment" 2>/dev/null)" @@ -31,8 +31,13 @@ export GPG_TTY="$(tty)" lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" +# Mute notifications or get kernel name. # Settings are different for MacOS (Darwin) systems. -case "$(uname)" in +[ -z "$MAILSYNC_MUTE" ] && notify="$(uname)" || notify="mute" +case "$notify" in + mute) + notify() { : ;} + ;; Darwin) notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} ;; @@ -56,7 +61,7 @@ syncandnotify() { if [ "$1" = "pop" ]; then # Handle POP mpop "$acc" - else + else # Handle IMAP if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi fi |