chore: debug nix-updates waybar indicator

This commit is contained in:
Swarsel 2024-08-10 17:14:05 +02:00
parent 560bc48259
commit d96c4de8dd
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 8 additions and 24 deletions

View file

@ -1,13 +1,8 @@
updates="$(cd ~/.dotfiles && nix flake lock --update-input nixpkgs && nix build .#nixosConfigurations."$HOSTNAME".config.system.build.toplevel && nvd diff /run/current-system ./result | grep -c '\[U')"
alt="has-updates"
if [[ $updates -eq 0 ]]; then
alt="updated"
fi
tooltip="System updated"
if [[ $updates != 0 ]]; then
tooltip=$(cd ~/.dotfiles && nvd diff /run/current-system ./result | grep -e '\[U' | awk '{ for (i=3; i<NF; i++) printf $i " "; if (NF >= 3) print $NF; }' ORS='\\n' )
fi
echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"
echo "{ \"text\":\"$updates\", \"tooltip\":\"$tooltip\" }"