#!/bin/sh # Displays number of unread mail and an loading icon if updating. 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="U" if [ $(pgrep gpg) ]; then emailicon="" else emailicon="" fi [ "$unread" = "0" ] && [ "$icon" = "" ] || echo "$emailicon$unread$icon"