#!/bin/bash

if ! pgrep -xf "^claws-mail .*" &>/dev/null
then
	swaymsg -q -- exec claws-mail --online
fi

stats=($(claws-mail --status))
status="$?"
new=${stats[0]}
unread=${stats[1]}

if [[ "$button" -eq 1 ]]
then
	swaymsg -q -- workspace 🖂
fi

if [[ "$unread" -eq 0 ]]
then
	color="#747369"
	icon="📪"
elif [[ "$new" -eq 0 ]]
then
	color="#FFCC66"
	icon="📫"
else
	color="#F2777A"
	icon="📬"
fi

echo "$icon"
