2021-02-13 20:17:23 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
######################################################################
|
2021-02-15 00:12:27 +01:00
|
|
|
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
|
2021-02-13 20:17:23 +01:00
|
|
|
# @file : sb-mailbox
|
2021-02-15 00:37:34 +01:00
|
|
|
# @license : GPLv3
|
2021-02-13 20:17:23 +01:00
|
|
|
# @created : Saturday Feb 13, 2021 18:15:13 CET
|
|
|
|
#
|
|
|
|
# @description : mail block for dwmblocks
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
|
2021-02-16 15:04:19 +01:00
|
|
|
unread=""
|
|
|
|
for acc in $(ls "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/)
|
|
|
|
do
|
2021-12-14 08:17:03 +01:00
|
|
|
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc/*/new/ -type f | grep -iv "trash" | wc -l 2>/dev/null)"
|
2021-02-16 20:58:23 +01:00
|
|
|
if [ $new -gt 0 ]; then
|
2022-01-14 11:10:56 +01:00
|
|
|
[ -n "$(echo "$acc" | sed -n '/@centrale/p')" ] && box=""
|
2022-10-17 12:41:35 +02:00
|
|
|
[ -n "$(echo "$acc" | sed -n '/@etu/p')" ] && box=""
|
2021-12-13 20:29:27 +01:00
|
|
|
[ -n "$(echo "$acc" | sed -n '/@mailo/p')" ] && box=""
|
|
|
|
[ -n "$(echo "$acc" | sed -n '/@posteo/p')" ] && box=""
|
2021-03-02 20:27:15 +01:00
|
|
|
unread="$unread/$box$new"
|
2021-02-16 15:04:19 +01:00
|
|
|
fi
|
|
|
|
done
|
2021-02-16 20:58:23 +01:00
|
|
|
[ -n "$unread" ] && unread="($(echo "$unread" | cut -c 2-))" || exit
|
2021-02-13 20:17:23 +01:00
|
|
|
|
2021-02-16 20:53:50 +01:00
|
|
|
printf " %s%s " "$unread" "$icon"
|