os/arch (panel): display notification on new email or updates
This commit is contained in:
parent
baba5ca61e
commit
5bd407b145
|
@ -23,6 +23,9 @@ get_mail() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mailtmp=/tmp/mail-count
|
||||||
|
touch "$mailtmp"
|
||||||
|
|
||||||
a=$(get_mail "${MAIL1_USER}" "${MAIL1_PASS}")
|
a=$(get_mail "${MAIL1_USER}" "${MAIL1_PASS}")
|
||||||
b=$(get_mail "${MAIL2_USER}" "${MAIL2_PASS}")
|
b=$(get_mail "${MAIL2_USER}" "${MAIL2_PASS}")
|
||||||
c=$(get_mail "${MAIL3_USER}" "${MAIL3_PASS}")
|
c=$(get_mail "${MAIL3_USER}" "${MAIL3_PASS}")
|
||||||
|
@ -33,6 +36,13 @@ color="${COLOR_FG}"
|
||||||
case $num in
|
case $num in
|
||||||
[1-9]*)
|
[1-9]*)
|
||||||
icon="$icon$num"
|
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}"
|
0) color="${COLOR_DIM}"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -2,9 +2,19 @@
|
||||||
|
|
||||||
. $(dirname $0)/../panel-config
|
. $(dirname $0)/../panel-config
|
||||||
|
|
||||||
|
updtmp=/tmp/update-count
|
||||||
|
touch "$updtmp"
|
||||||
|
|
||||||
num=$({ checkupdates; cower -u; } | wc -l)
|
num=$({ checkupdates; cower -u; } | wc -l)
|
||||||
if [ "$num" -gt 0 ]
|
if [ "$num" -gt 0 ]
|
||||||
then
|
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-}"
|
echo "U%{F${COLOR_2}}$ICON_UPD$num%{F-}"
|
||||||
else
|
else
|
||||||
echo "U%{F${COLOR_DIM}}$ICON_UPD%{F-}"
|
echo "U%{F${COLOR_DIM}}$ICON_UPD%{F-}"
|
||||||
|
|
Loading…
Reference in a new issue