aboutsummaryrefslogtreecommitdiff
path: root/.config/yambar/scripts/arch-updates.sh
blob: 7b4f489d29c80f851e490b3d555a3a159be05433 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash

function update-yambar {
echo "updates|string|"
echo ""

while true; do

xbps-install -Mun 1> /tmp/void-updates
# updates="$(cat /tmp/void-updates | awk '{ print $1 }')"
# number="$(cat /tmp/void-updates | wc -l)"
#
# if [ "$number" -gt 0 ]; then
#     text=" $number"
# else
#     text=""
# fi
updates="$(checkupdates;paru -Qum)"
arch="$(checkupdates | wc -l)"
aur="$(paru -Qum | wc -l)"
number=$((arch+aur))

if [ "$number" -gt 0 ]; then
    text="  $number"
else
    text=""
fi

echo "updates|string|$text"
echo ""
sleep 30m

done
}

function update {
	foot bash -c "paru"; sh -c "~/.config/yambar/scripts/yambar-start.sh"
}

case $1 in
	update)
		update
		;;
	*)
		update-yambar
		;;
esac
exit 0