aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/sketchybar/bar-config/plugins/mail.sh
blob: 7ce2fe6a5afb18e1ae7ee3396db6f186355fb432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash
# Waybar used a custom mail.py; here we read Mail.app's unread inbox count.
# (First run may prompt for Automation permission. Swap this for your provider.)
source "$HOME/.config/sketchybar/icons.sh"

UNREAD="$(osascript -e 'tell application "Mail" to get unread count of inbox' 2>/dev/null)"

if [ -n "$UNREAD" ] && [ "$UNREAD" -gt 0 ] 2>/dev/null; then
  sketchybar --set "$NAME" label="$MAIL $UNREAD"
else
  sketchybar --set "$NAME" label="$MAIL"
fi