aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/mailsync
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-09-19 14:05:14 +0300
committerYaroslav <contact@yaroslavps.com>2020-09-19 14:05:14 +0300
commit469b6ff8faa9d52311f5afbd8979649c4468e30b (patch)
tree608fa95b4c5a69a645b7947b9cf03f927415403f /dotfiles/.local/bin/mailsync
parenta68febd54a55e9954c92d5d42d098530fbbc24d4 (diff)
downloadswayrice-469b6ff8faa9d52311f5afbd8979649c4468e30b.tar.gz
swayrice-469b6ff8faa9d52311f5afbd8979649c4468e30b.zip
Change location of mbsync, notmuch config files
Diffstat (limited to 'dotfiles/.local/bin/mailsync')
-rwxr-xr-xdotfiles/.local/bin/mailsync12
1 files changed, 8 insertions, 4 deletions
diff --git a/dotfiles/.local/bin/mailsync b/dotfiles/.local/bin/mailsync
index 431d314..2c70f27 100755
--- a/dotfiles/.local/bin/mailsync
+++ b/dotfiles/.local/bin/mailsync
@@ -1,6 +1,10 @@
#!/bin/sh
# Sync mail and give notification if there is new mail.
+# Config files
+notmuchrc="$XDG_CONFIG_HOME/notmuchrc"
+mbsyncrc="$XDG_CONFIG_HOME/mbsyncrc"
+
# Run only if user logged in (prevent cron errors)
w | grep "^$USER\W" >/dev/null || exit
@@ -18,9 +22,9 @@ thereis=0
# Run mbsync. You can feed this script different settings.
if [ $# -eq 0 ]; then
- mbsync -a
+ mbsync -c "$mbsyncrc" -a
else
- mbsync "$@"
+ mbsync -c "$mbsyncrc" "$@"
fi
# Check all accounts/mailboxes for new mail. Notify if there is new content.
@@ -35,11 +39,11 @@ do
done
if [ $thereis = 1 ]; then
- mpv "$HOME/.local/share/soundalerts/mail.mp3" > /dev/null
+ mpv --really-quiet "$HOME/.local/share/soundalerts/mail.mp3"
killall -43 waybar
fi
-notmuch new 2>/dev/null
+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"