chore(waybar): improve custom pacman module
This commit is contained in:
@@ -86,8 +86,9 @@
|
|||||||
"interval": 60,
|
"interval": 60,
|
||||||
"tooltip": true,
|
"tooltip": true,
|
||||||
"format": "{} ",
|
"format": "{} ",
|
||||||
|
"return-type": "json",
|
||||||
"exec": "$HOME/.config/waybar/scripts/check-updates.sh",
|
"exec": "$HOME/.config/waybar/scripts/check-updates.sh",
|
||||||
"exec-if": "[[ `$HOME/.config/waybar/scripts/check-updates.sh` != 0 ]]",
|
"exec-if": "[[ `checkupdates | wc -l` != 0 ]]",
|
||||||
"signal": 1
|
"signal": 1
|
||||||
},
|
},
|
||||||
"custom/recorder": {
|
"custom/recorder": {
|
||||||
|
@@ -1,7 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
checkupdates | wc -l
|
updates=$(checkupdates --nocolor 2>/dev/null)
|
||||||
|
if [[ $? -ne 0 || -z "$updates" ]]; then
|
||||||
|
echo '{"text": "", "tooltip": ""}' | jq --unbuffered --compact-output
|
||||||
|
else
|
||||||
|
numberOfUpdates=$(echo "$updates" | wc -l)
|
||||||
|
tooltip=$(echo "$updates" | sed 's/\n/\r/g' | jq -sR .)
|
||||||
|
echo "{\"text\": \"$numberOfUpdates\", \"tooltip\": $tooltip}" | jq --unbuffered --compact-output
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
Reference in New Issue
Block a user