aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xScripts/.local/scripts/mail_fetch6
-rw-r--r--SystemD/.config/systemd/user/mail.service6
-rw-r--r--SystemD/.config/systemd/user/mail.timer10
3 files changed, 22 insertions, 0 deletions
diff --git a/Scripts/.local/scripts/mail_fetch b/Scripts/.local/scripts/mail_fetch
new file mode 100755
index 0000000..6ee28fc
--- /dev/null
+++ b/Scripts/.local/scripts/mail_fetch
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+
+prev=$(notmuch count)
+mbsync -a
+new=$(notmuch count)
+notify-send "mail_fetch: Fetched $(echo $new - $prev | bc -l) mail"
diff --git a/SystemD/.config/systemd/user/mail.service b/SystemD/.config/systemd/user/mail.service
new file mode 100644
index 0000000..16d87c5
--- /dev/null
+++ b/SystemD/.config/systemd/user/mail.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=Syncing mail using mbsyncrc
+
+[Service]
+Type=simple
+ExecStart=%h/.local/scripts/mail_fetch
diff --git a/SystemD/.config/systemd/user/mail.timer b/SystemD/.config/systemd/user/mail.timer
new file mode 100644
index 0000000..0d1b970
--- /dev/null
+++ b/SystemD/.config/systemd/user/mail.timer
@@ -0,0 +1,10 @@
+[Unit]
+Description=Run mail sync every 3 hours
+
+[Timer]
+OnBootSec=1min
+OnUnitActiveSec=10800
+Unit=mail.service
+
+[Install]
+WantedBy=timers.target