summaryrefslogtreecommitdiff
path: root/bin/mailsync
diff options
context:
space:
mode:
Diffstat (limited to 'bin/mailsync')
-rwxr-xr-xbin/mailsync9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/mailsync b/bin/mailsync
index d79507d..f7c3211 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -2,12 +2,13 @@
# Sync mail and give notification if there is new mail.
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
+DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
+export DBUS_SESSION_BUS_ADDRESS
export DISPLAY=:0.0
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
# Run only if user logged in (prevent cron errors)
-pgrep -u "$USER" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
+pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
# Run only if not already running in other instance
pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;}
@@ -47,7 +48,7 @@ else
fi
echo " 🔃" > /tmp/imapsyncicon_"$USER"
-pkill -RTMIN+12 i3blocks >/dev/null 2>&1
+pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1
# Parallelize multiple accounts
for account in $accounts
@@ -57,7 +58,7 @@ done
wait
rm -f /tmp/imapsyncicon_"$USER"
-pkill -RTMIN+12 i3blocks >/dev/null 2>&1
+pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1
notmuch new 2>/dev/null