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

@ -4567,25 +4567,21 @@ done
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\" }"
#+end_src
#+begin_src nix :tangle pkgs/update-checker/default.nix
{ writeShellApplication, sway}:
{ writeShellApplication, nvd}:
writeShellApplication {
name = "update-checker";
runtimeInputs = [ nvd ];
text = builtins.readFile ../../scripts/update-checker.sh;
}
#+end_src
@ -7666,11 +7662,7 @@ The rest of this configuration is found here:
interval = 3600;
tooltip = true;
return-type = "json";
format = "{} {icon} ?";
format-icons = {
has-updates = "";
updated= "";
};
format = "{} ";
};
"group/hardware" = {