summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorWayne Reeves <darthwayne@hotmail.com>2022-08-17 19:49:28 -0500
committerWayne Reeves <darthwayne@hotmail.com>2022-08-17 19:49:28 -0500
commitb7f2bc0ff14f7da6cf2d7c4186bed0dfe925510f (patch)
treee9bb4034d3c015d8ff37e849723bc8107361a43a /bin
parenta47042582c87af98aef1999f6b64b20b1d6c5cde (diff)
check for MAILSYNC_MUTE
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mailsync9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/mailsync b/bin/mailsync
index 854e1d1..818158d 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\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \
+ "^\s*\(export \)\?\(MBSYNCRC\|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)"
@@ -30,8 +30,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="no"
+case "$notify" in
+ no)
+ notify() { echo "notifications disabled" >/dev/null ;}
+ ;;
Darwin)
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
;;