add waybar-void-update-checker
This commit is contained in:
parent
6b6b0f8f7b
commit
381ab705c4
2 changed files with 21 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
"modules-center": [
|
"modules-center": [
|
||||||
],
|
],
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
|
"custom/void-updates",
|
||||||
|
|
||||||
{% for iface in host.wireless + host.ethernet %}
|
{% for iface in host.wireless + host.ethernet %}
|
||||||
"network#{{ iface }}",
|
"network#{{ iface }}",
|
||||||
|
@ -37,6 +38,14 @@
|
||||||
"niri/workspaces": {
|
"niri/workspaces": {
|
||||||
"format": "\uf111"
|
"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 %}
|
{% for iface in host.wireless %}
|
||||||
"network#{{ iface }}": {
|
"network#{{ iface }}": {
|
||||||
|
|
12
templates/bin/waybar-void-update-checker
Executable file
12
templates/bin/waybar-void-update-checker
Executable 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"}'
|
Loading…
Add table
Reference in a new issue