feat(waybar): show pacman updates available
This commit is contained in:
parent
0b8cabcf5a
commit
0e797ea18f
@ -17,6 +17,7 @@
|
||||
"custom/media"
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/pacman-update",
|
||||
"custom/asusmode",
|
||||
"network",
|
||||
"clock",
|
||||
@ -195,6 +196,14 @@
|
||||
"return-type": "json",
|
||||
"on-click": "playerctl play-pause",
|
||||
"exec": "~/.config/waybar/scripts/get-media.bash"
|
||||
},
|
||||
"custom/pacman-update": {
|
||||
"return-type": "json",
|
||||
"exec": "~/.config/waybar/scripts/get-pacman-package-updates.bash",
|
||||
"exec-if": "((\"$(checkupdates | wc -l)\" > 0))",
|
||||
"format": " {}",
|
||||
"tooltip": true,
|
||||
"interval": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
|
18
dots/.config/waybar/scripts/get-pacman-package-updates.bash
Executable file
18
dots/.config/waybar/scripts/get-pacman-package-updates.bash
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
main() {
|
||||
local package_updates
|
||||
package_updates="$(checkupdates | cut -d " " -f1)"
|
||||
package_update_number="$(printf "%s" "${package_updates}" | wc -l)"
|
||||
|
||||
# Limit the number of results shown to ten, add trailing ellipsis
|
||||
if ((package_update_number > 10)); then
|
||||
package_updates="$(printf "%s" "${package_updates}" | head -n 10)"
|
||||
package_updates+="\n..."
|
||||
fi
|
||||
|
||||
|
||||
printf '{"text": "%s", "tooltip": "%s"}\n' "${package_update_number}" "${package_updates//$'\n'/\\n}"
|
||||
}
|
||||
|
||||
main
|
@ -66,6 +66,7 @@
|
||||
#clock,
|
||||
#wireplumber,
|
||||
#image,
|
||||
#custom-pacman-update,
|
||||
#custom-lock {
|
||||
background-color: #16161d;
|
||||
color: #dcd7ba;
|
||||
@ -221,6 +222,11 @@
|
||||
background-color: #ff5d62;
|
||||
}
|
||||
|
||||
/* Pacman Updates */
|
||||
#custom-pacman-update {
|
||||
color: #7E9CD8;
|
||||
}
|
||||
|
||||
/* Asus Fan Mode */
|
||||
#custom-asusmode {
|
||||
color: #ffa066;
|
||||
|
Loading…
Reference in New Issue
Block a user