summaryrefslogtreecommitdiff
path: root/shell-scripts/sb-mailbox
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-06-28 00:39:56 +0200
committerMike Vink <mike1994vink@gmail.com>2023-06-28 00:39:56 +0200
commit3ff163f82355aba1cbd60332309209bbe5cd92c9 (patch)
tree81cf22c6a186257e997331bba076c425704fcd93 /shell-scripts/sb-mailbox
parentf4effc7665bf280c8587c6c65e4ee769d0244363 (diff)
email update
Diffstat (limited to 'shell-scripts/sb-mailbox')
-rw-r--r--shell-scripts/sb-mailbox20
1 files changed, 20 insertions, 0 deletions
diff --git a/shell-scripts/sb-mailbox b/shell-scripts/sb-mailbox
new file mode 100644
index 0000000..ab1669e
--- /dev/null
+++ b/shell-scripts/sb-mailbox
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Displays number of unread mail and an loading icon if updating.
+# When clicked, brings up `neomutt`.
+
+case $BUTTON in
+ 1) setsid -f "$TERMINAL" -e neomutt ;;
+ 2) setsid -f mailsync >/dev/null ;;
+ 3) notify-send "📬 Mail module" "\- Shows unread mail
+- Shows 🔃 if syncing mail
+- Left click opens neomutt
+- Middle click syncs mail" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
+
+pidof mbsync >/dev/null 2>&1 && icon="🔃"
+
+[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬$unread$icon"