Waybar: Add checkupdates script

Update path and signal in config, add IPC support (maybe pkill will work
and update the module without killing the whole waybar?)
This commit is contained in:
Harzo 2023-05-26 14:51:07 +02:00
parent 249cc318e0
commit 8f1247b0a6
2 changed files with 17 additions and 3 deletions

View File

@ -3,6 +3,7 @@
"position": "top",
"height": 30,
"spacing": 4,
"ipc": true,
"modules-left": [
"clock",
"custom/weather",
@ -91,10 +92,10 @@
"format": "󰏗 {}",
"interval": "3600",
"return-type": "json",
"exec": "$HOME/.local/bin/scripts/checkupdates",
"exec": "$HOME/.config/waybar/scripts/checkupdates",
"exec-if": "exit 0",
"signal": 12,
"on-click": "foot paru; pkill waybar; waybar &"
"signal": 8,
"on-click": "foot paru; pkill -SIGRTMIN+8 waybar"
},
"custom/weather": {
"exec": "curl -s 'https://wttr.in/?format=1' | sed 's/ \\+/ /g'",

View File

@ -0,0 +1,13 @@
#!/bin/sh
updates="$(paru -Qua | wc -l)"
count="$(echo "$(paru -Qua | wc -l) + $(pacman -Qu | wc -l)" | bc)"
class="ok"
if [ "$count" -gt 0 ]; then
class="urgent"
elif [ "$count" -gt 10 ]; then
class="warning"
fi
echo '{"text": "'$count'", "tooltip": "Updates pending: '$count'", "class": "'$class'"}'