users/ryan/modules/sketchybar/bar-config/plugins/mail.sh
08d200c7b0c9210afe5bc2819b99a2726b4421a7
· 473 B · 12 lines
raw
| 1 | #!/usr/bin/env bash |
| 2 | # Waybar used a custom mail.py; here we read Mail.app's unread inbox count. |
| 3 | # (First run may prompt for Automation permission. Swap this for your provider.) |
| 4 | source "$HOME/.config/sketchybar/icons.sh" |
| 5 | |
| 6 | UNREAD="$(osascript -e 'tell application "Mail" to get unread count of inbox' 2>/dev/null)" |
| 7 | |
| 8 | if [ -n "$UNREAD" ] && [ "$UNREAD" -gt 0 ] 2>/dev/null; then |
| 9 | sketchybar --set "$NAME" label="$MAIL $UNREAD" |
| 10 | else |
| 11 | sketchybar --set "$NAME" label="$MAIL" |
| 12 | fi |