os/arch (lemonbar+dunst): better email/update notifications + sound

This commit is contained in:
Henrik Lissner 2016-12-26 00:28:53 -05:00
parent 978c57c6e1
commit 2a0149e61e
2 changed files with 7 additions and 6 deletions

View file

@ -36,11 +36,12 @@ color="${COLOR_FG}"
case $num in
[1-9]*)
icon="$icon$num"
lastnum=$(<$mailtmp)
lastnum=$(cat "$mailtmp")
if [[ $num != $lastnum ]]; then
echo "$num" > "$mailtmp"
if (( $num > $lastnum )); then
notify-send "New messages" "You have $(( $num - $mailtmp )) new messages"
notify-send "New messages" "You have $(( $num - $lastnum )) new messages"
aplay -N -q /usr/share/sounds/ding.wav
fi
fi
;;

View file

@ -6,13 +6,13 @@ updtmp=/tmp/update-count
touch "$updtmp"
num=$({ checkupdates; cower -u; } | wc -l)
if [ "$num" -gt 0 ]
then
lastnum=$(<$updtmp)
if [ "$num" -gt 0 ]; then
lastnum=$(cat $updtmp)
if [ "$num" -ne "${lastnum:-0}" ]; then
echo "$num" > "$updtmp"
if [ "$num" -gt "${lastnum:-0}" ]; then
notify-send "$num new updates available"
notify-send "$(( $num - $lastnum )) new update(s) available"
aplay -N -q /usr/share/sounds/ding.wav
fi
fi
echo "U%{F${COLOR_2}}$ICON_UPD$num%{F-}"