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 case $num in
[1-9]*) [1-9]*)
icon="$icon$num" icon="$icon$num"
lastnum=$(<$mailtmp) lastnum=$(cat "$mailtmp")
if [[ $num != $lastnum ]]; then if [[ $num != $lastnum ]]; then
echo "$num" > "$mailtmp" echo "$num" > "$mailtmp"
if (( $num > $lastnum )); then 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
fi fi
;; ;;

View file

@ -6,13 +6,13 @@ updtmp=/tmp/update-count
touch "$updtmp" 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=$(cat $updtmp)
lastnum=$(<$updtmp)
if [ "$num" -ne "${lastnum:-0}" ]; then if [ "$num" -ne "${lastnum:-0}" ]; then
echo "$num" > "$updtmp" echo "$num" > "$updtmp"
if [ "$num" -gt "${lastnum:-0}" ]; then 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
fi fi
echo "U%{F${COLOR_2}}$ICON_UPD$num%{F-}" echo "U%{F${COLOR_2}}$ICON_UPD$num%{F-}"