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