add waybar-void-update-checker

This commit is contained in:
Adam Gausmann 2025-06-04 11:30:50 -05:00
parent 6b6b0f8f7b
commit 381ab705c4
2 changed files with 21 additions and 0 deletions

View file

@ -10,6 +10,7 @@
"modules-center": [
],
"modules-right": [
"custom/void-updates",
{% for iface in host.wireless + host.ethernet %}
"network#{{ iface }}",
@ -37,6 +38,14 @@
"niri/workspaces": {
"format": "\uf111"
},
"custom/void-updates": {
"exec": "waybar-void-update-checker",
"hide-empty-text": true,
"return-type": "json",
// every 7 hours
"interval": 25200,
},
{% for iface in host.wireless %}
"network#{{ iface }}": {

View file

@ -0,0 +1,12 @@
#!/bin/sh
set -e
info="$(xbps-install -Mun)"
PKG_COUNT="$(echo "$info" | wc -l)"
[ $PKG_COUNT -eq 0 ] && exit
DL_SIZE="$(echo "$info" | awk '{s+=$6}END{print s}' | numfmt --to=iec-i)B"
echo '{"text": "\uf468 '"$PKG_COUNT"'", "tooltip": "'"$PKG_COUNT"' packages have updates; '"$DL_SIZE"' download"}'