39 lines
1.1 KiB
Bash
39 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# check updates and show how many packeges to update in Conky
|
||
|
|
||
|
# We don't need to run checkupdates at Conky start as it takes few seconds and block Conky
|
||
|
|
||
|
CNF_DIR="$HOME/.config/colorizer/conky"
|
||
|
CNF_FILE="$CNF_DIR/conky.cfg"
|
||
|
source <(grep = $CNF_FILE)
|
||
|
|
||
|
case "$1" in
|
||
|
-s)
|
||
|
CONKYPID=$(pgrep -f sysinfo_mbcolor)
|
||
|
;;
|
||
|
-g)
|
||
|
CONKYPID=$(pgrep -f sysinfo_graph_mbcolor)
|
||
|
;;
|
||
|
*)
|
||
|
:
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
if [ -f /tmp/"$CONKYPID" ]; then
|
||
|
PKGS=$(pamac checkupdates -aq| wc -l)
|
||
|
if [ "$PKGS" != "0" ]; then
|
||
|
if [[ "$update_notifications" == "true" ]];then
|
||
|
notify-send.sh -i mbcc "Updates available" "Packages to update: $PKGS" -o "Update with yay (cli):terminator -T 'Update packages with yay' -e yay" \
|
||
|
-o "Update with Pamac (GUI):pamac-manager --updates" -o "Disable notifications:mb-setvar update_notifications=false ${CNF_FILE}"
|
||
|
fi
|
||
|
printf "\${font}\${alignr} Available updates: \${color red}"
|
||
|
echo "$PKGS"
|
||
|
else
|
||
|
printf "\${font}\${color}\${alignr} System is up to date :)"
|
||
|
fi
|
||
|
else
|
||
|
echo "$SUM" > /tmp/${CONKYPID}
|
||
|
fi
|