--- /dev/null
+# Install
+`sudo setup.sh`
+Make your Maildir read/writeable by `mailcount` group
+# Uninstall
+`sudo rm /usr/local/bin/mailcount`
--- /dev/null
+[Unit]
+Description=Mailbox Count and Sync Service
+After=network.target mail-count.timer
+Requires=mail-count.timer
+
+[Service]
+Type=oneshot
+User=mailcount
+Group=mailcount
+ExecStart=/usr/bin/bash -c "/usr/bin/dbus-send --type=method_call --session --dest=com.jacobcasper.Mail /com/jacobcasper/Mail/Unread com.jacobcasper.Mail.UnreadCount uint32:$(/usr/local/bin/mailcount)"
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+[Unit]
+Description=Mailbox Sync and Count Timer
+After=network.target
+
+[Timer]
+OnActiveSec=1s
+OnUnitActiveSec=5m
+Unit=mail-count.service
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+#!/bin/bash
+
+mkdir -p /usr/share/mailcount
+groupadd mailcount
+useradd -g mailcount -d /usr/share/mailcount -s $(which nologin) mailcount
+chown mailcount:mailcount /usr/share/mailcount
+chmod 700 /usr/share/mailcount
+cp mail-count.* /etc/systemd/system/
+ln -f unread_mail_counts.sh /usr/local/bin/mailcount
--- /dev/null
+#!/bin/sh
+# Shouldn't require any GNU utils, but not 100% on that negative lookahead flag
+mbsync -c /home/jcasper/.mbsyncrc -aq
+find /home/jcasper/mail/INBOX/ -type f -not -path '*/\.*' -print \
+ | grep -P '.*U=.*:2,(?!.*S)' \
+ | wc -l