dot/.local/bin/i3scripts/contrib/yaourt

45 lines
864 B
Plaintext
Raw Normal View History

2021-12-20 21:49:21 +00:00
#!/usr/bin/env bash
################################
# Shows AUR packages that need updated.
#
# Dependencies:
# - checkupdates
# - yaourt
# - [notify-send]
#
# @return {Number}: Outdated packages
################################
dir=$(dirname $0)
source $dir/util.sh
full=""
short=""
status=0
archPackages=$(checkupdates)
allPackages=$(yaourt -Quaq)
numArchPackages=$(numLines "$archPackages")
numAllPackages=$(numLines "$allPackages")
numAurPackages=$(calc "$numAllPackages - $numArchPackages")
if [ $numAllPackages -le $numArchPackages ]; then
numAurPackages=$numAllPackages
fi
full=$numAurPackages
short=$full
case $BLOCK_BUTTON in
# right click: show packages
3)
aurPackages=$(diff -y <(echo "$archPackages") <(echo "$allPackages") | awk -p '{ print $3 }')
notify-send "AUR packages" "$aurPackages"
;;
esac
echo $full
echo $short
exit $status