os/arch (panel): display notification on new email or updates

This commit is contained in:
Henrik Lissner 2016-12-24 16:21:01 -05:00
parent baba5ca61e
commit 5bd407b145
2 changed files with 20 additions and 0 deletions

View file

@ -23,6 +23,9 @@ get_mail() {
fi
}
mailtmp=/tmp/mail-count
touch "$mailtmp"
a=$(get_mail "${MAIL1_USER}" "${MAIL1_PASS}")
b=$(get_mail "${MAIL2_USER}" "${MAIL2_PASS}")
c=$(get_mail "${MAIL3_USER}" "${MAIL3_PASS}")
@ -33,6 +36,13 @@ color="${COLOR_FG}"
case $num in
[1-9]*)
icon="$icon$num"
lastnum=$(<$mailtmp)
if [[ $num != $lastnum ]]; then
echo "$num" > "$mailtmp"
if (( $num > $lastnum )); then
notify-send "New messages" "You have $(( $num - $mailtmp )) new messages"
fi
fi
;;
0) color="${COLOR_DIM}"
;;

View file

@ -2,9 +2,19 @@
. $(dirname $0)/../panel-config
updtmp=/tmp/update-count
touch "$updtmp"
num=$({ checkupdates; cower -u; } | wc -l)
if [ "$num" -gt 0 ]
then
lastnum=$(<$updtmp)
if [ "$num" -ne "${lastnum:-0}" ]; then
echo "$num" > "$updtmp"
if [ "$num" -gt "${lastnum:-0}" ]; then
notify-send "$num new updates available"
fi
fi
echo "U%{F${COLOR_2}}$ICON_UPD$num%{F-}"
else
echo "U%{F${COLOR_DIM}}$ICON_UPD%{F-}"