aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/mailsync
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/.local/bin/mailsync')
-rwxr-xr-xdotfiles/.local/bin/mailsync12
1 files changed, 5 insertions, 7 deletions
diff --git a/dotfiles/.local/bin/mailsync b/dotfiles/.local/bin/mailsync
index d67db06..ad69337 100755
--- a/dotfiles/.local/bin/mailsync
+++ b/dotfiles/.local/bin/mailsync
@@ -9,14 +9,14 @@ notmuchrc="$HOME/.config/notmuchrc"
mbsyncrc="$HOME/.config/mbsyncrc"
# Run only if user logged in (prevent cron errors)
-w | grep "^$USER\W" >/dev/null || exit
+# w | grep "^$USER\W" >/dev/null || exit
# Don't run if screen is locked (gpg key is locked too)
-pidof swaylock && exit
+# pidof swaylock && exit
# Check several times before giving up, useful when just waking up from sleep
# since internet is usually not available right away
-wget -q --tries=3 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
+wget -q --tries=3 --timeout=20 --spider http://1.1.1.1 > /dev/null || exit
thereis=0
@@ -33,18 +33,16 @@ do
account="$(echo "$mailbox" | sed "s/.*\///")"
newcount=$(find "$HOME/.local/share/mail/$account/INBOX/new/" "$HOME/.local/share/mail/$account/Inbox/new/" "$HOME/.local/share/mail/$account/inbox/new/" -type f -newer "$HOME/.cache/lastmailsync" 2> /dev/null | wc -l)
if [ "$newcount" -gt "0" ]; then
- notify-send "📬 Email" "$newcount new mail(s) in \`$account\` mailbox."
+ notify-send -a "E-mail" -i mail-client "$newcount new mail(s) in \`$account\` mailbox."
thereis=1
fi
done
if [ $thereis = 1 ]; then
- mpv --really-quiet "$HOME/.local/share/soundalerts/mail.ogg"
- killall -43 waybar
+ mpv --keep-open=no --really-quiet "$HOME/.local/share/soundalerts/mail.ogg"
fi
notmuch -c "$notmuchrc" new 2>/dev/null
# Create a touch file that indicates the time of the last run of mailsync
touch "$HOME/.cache/lastmailsync"
-