/ src / pkgnotify /
/src/pkgnotify/pkgnotify.sh
1 #!/bin/bash
2
3 # depends on: dzen2, package-query, yaourt and inotifywait (included in
4 # inotify-tools)
5 #
6 # % sudo crontab -l -u root
7 # 20 * * * * yaourt -Sy
8
9 TMPFILE="/tmp/updateslist"
10 FONT="-adobe-helvetica-medium-*-normal-*-12-*-75-*-*-*-*-*"
11
12 while :
13 do
14 pc=$(package-query -QAu 2> "/dev/null" | tee "/tmp/updateslist" | wc -l)
15
16 if [ "$pc" -gt 1 ]; then # found some
17 echo -e "^fg(#FF0000)$pc updates^fg()\n$(cat $TMPFILE)" | dzen2 -p -h 22 -ta l -l $pc -fn $FONT -bg black &
18 elif [ "$pc" -eq 1 ]; then # found something
19 echo -e "^fg(#FF0000)1 update^fg()\n$(cat $TMPFILE)" | dzen2 -p -h 22 -ta l -l $pc -fn $FONT -bg black &
20 else
21 echo -e "no updates" | dzen2 -p -h 22 -ta l -fn $FONT -bg black &
22 fi
23 inotifywait "/var/lib/pacman/local/"
24 done