1 #!/bin/sh 2 3 # Displays number of unread mail and an loading icon if updating. 4 # When clicked, brings up `neomutt`. 5 6 case $BLOCK_BUTTON in 7 1) setsid -f "$TERMINAL" -e neomutt ;; 8 2) setsid -f mw sync >/dev/null ;; 9 3) notify-send "📬 Mail module" "\- Shows unread mail 10 - Shows 🔃 if syncing mail 11 - Left click opens neomutt 12 - Middle click syncs mail" ;; 13 6) "$TERMINAL" -e "$EDITOR" "$0" ;; 14 esac 15 16 unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" 17 18 pidof mbsync >/dev/null 2>&1 && icon="🔃" 19 20 [ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬$unread$icon"