summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xbin/mailsync3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/mailsync b/bin/mailsync
index 0fcb43b..75a7376 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -125,11 +125,12 @@ run_sync() {
 
 	# persistent notification
 	id=$(notifysend "${acct}: fetching new mail..." "running mbsync" -i "$(iconez -sn email-sync-outline)" --print-id --expire-time=0)
+	trap '{ clear-notification "$id"; }' EXIT
 
 	mbsync_args=
 	[ -n "${verbose}" ] && mbsync_args="--verbose"
 	mbsync $mbsync_args --config="$HOME/.config/mbsyncrc" "$acct"
-	clear-notification "$id"
+
 	# create cachefile
 	touch "${cachefile}.${acct}"