sb-mailbox (672B)
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 -w -f "$TERMINAL" -e neomutt; pkill -RTMIN+12 "${STATUSBAR:-dwmblocks}" ;; 8 2) setsid -f mw -Y >/dev/null ;; 9 3) notify-send "M Mail module" "\- Shows unread mail 10 - Shows S if syncing mail 11 - Left click opens neomutt 12 - Middle click syncs mail" ;; 13 6) setsid -f "$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="S" 19 20 [ "$unread" = "0" ] && [ "$icon" = "" ] || echo "M$unread$icon"