mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
chore: debug nix-updates waybar indicator
This commit is contained in:
parent
560bc48259
commit
d96c4de8dd
4 changed files with 8 additions and 24 deletions
|
|
@ -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')"
|
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"
|
tooltip="System updated"
|
||||||
if [[ $updates != 0 ]]; then
|
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' )
|
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
|
fi
|
||||||
|
|
||||||
echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"
|
echo "{ \"text\":\"$updates\", \"tooltip\":\"$tooltip\" }"
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src nix :tangle pkgs/update-checker/default.nix
|
#+begin_src nix :tangle pkgs/update-checker/default.nix
|
||||||
{ writeShellApplication, sway}:
|
{ writeShellApplication, nvd}:
|
||||||
|
|
||||||
writeShellApplication {
|
writeShellApplication {
|
||||||
name = "update-checker";
|
name = "update-checker";
|
||||||
|
runtimeInputs = [ nvd ];
|
||||||
text = builtins.readFile ../../scripts/update-checker.sh;
|
text = builtins.readFile ../../scripts/update-checker.sh;
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -7666,11 +7662,7 @@ The rest of this configuration is found here:
|
||||||
interval = 3600;
|
interval = 3600;
|
||||||
tooltip = true;
|
tooltip = true;
|
||||||
return-type = "json";
|
return-type = "json";
|
||||||
format = "{} {icon} ?";
|
format = "{} ";
|
||||||
format-icons = {
|
|
||||||
has-updates = "";
|
|
||||||
updated= "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
"group/hardware" = {
|
"group/hardware" = {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{ writeShellApplication, sway }:
|
{ writeShellApplication, nvd }:
|
||||||
|
|
||||||
writeShellApplication {
|
writeShellApplication {
|
||||||
name = "update-checker";
|
name = "update-checker";
|
||||||
|
runtimeInputs = [ nvd ];
|
||||||
text = builtins.readFile ../../scripts/update-checker.sh;
|
text = builtins.readFile ../../scripts/update-checker.sh;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,7 @@
|
||||||
interval = 3600;
|
interval = 3600;
|
||||||
tooltip = true;
|
tooltip = true;
|
||||||
return-type = "json";
|
return-type = "json";
|
||||||
format = "{} {icon} ?";
|
format = "{} ";
|
||||||
format-icons = {
|
|
||||||
has-updates = "";
|
|
||||||
updated = "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
"group/hardware" = {
|
"group/hardware" = {
|
||||||
|
|
|
||||||
|
|
@ -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')"
|
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"
|
tooltip="System updated"
|
||||||
if [[ $updates != 0 ]]; then
|
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' )
|
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
|
fi
|
||||||
|
|
||||||
echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"
|
echo "{ \"text\":\"$updates\", \"tooltip\":\"$tooltip\" }"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue