@@ -17,6 +17,7 @@ export DISPLAY=:0.0
# For individual configurations:
# For individual configurations:
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
[ -f "$HOME/.config/isync/mbsyncrc" ] && MBSYNC="mbsync -c \"$HOME/.config/isync/mbsyncrc\"" || MBSYNC="mbsync"
# Settings are different for MacOS (Darwin) systems.
# Settings are different for MacOS (Darwin) systems.
if [ "$(uname)" = "Darwin" ]; then
if [ "$(uname)" = "Darwin" ]; then
@@ -30,7 +31,7 @@ fi
# Check account for new mail. Notify if there is new content.
# Check account for new mail. Notify if there is new content.
syncandnotify() {
syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")"
acc="$(echo "$account" | sed "s/.*\///")"
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" " $acc"; fi
if [ -z "$opts" ]; then eval "$MBSYNC $acc"; else eval "$MBSYNC $opts $acc"; fi
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null)
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null)
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
if [ "$newcount" -gt "0" ]; then
if [ "$newcount" -gt "0" ]; then
@@ -46,7 +47,7 @@ syncandnotify() {
# Sync accounts passed as argument or all.
# Sync accounts passed as argument or all.
if [ "$#" -eq "0" ]; then
if [ "$#" -eq "0" ]; then
accounts="$(awk '/^Channel/ {print $2}' "$HOME/.mbsyncrc")"
[ -f "$HOME/.config/isync/mbsyncrc" ] && accounts="$(awk '/^Channel/ {print $2}' "$HOME/.config/isync/mbsyncrc")" || accounts="$(awk '/^Channel/ {print $2}' "$HOME/.mbsyncrc")"
else
else
for arg in "$@"; do
for arg in "$@"; do
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1