dotfiles/.i3blocks/updates

31 lines
669 B
Text
Raw Normal View History

#!/usr/bin/env bash
if [ -f /dev/shm/claws_offline ]
then
echo "<span foreground=\"#F2777A\">█</span>"
exit
fi
if [ ! -f /dev/shm/updates ]
then
echo 0 > /dev/shm/updates
fi
avail=$(checkupdates | wc -l)
2018-03-27 17:38:03 +02:00
aur=$(yaourt -Qua | grep 'aur/' | wc -l)
total=$(($avail + $aur))
if [[ $total -eq 0 ]]
then
echo "<span foreground=\"#99CC99\">█</span>"
else
2018-03-27 17:38:03 +02:00
echo "<span foreground=\"#FFCC66\">█</span>"
if [[ $(cat /dev/shm/updates) -ne $total ]]
then
[[ $total -eq 1 ]] && notify-send "Mise à jour disponible" "1 màj disponible"
[[ $total -gt 1 ]] && notify-send "Mises à jour disponibles" "$total màj disponibles"
fi
fi
echo $total > /dev/shm/updates