From d96c4de8dddf98ca4ca0f2caafc045e13f099e41 Mon Sep 17 00:00:00 2001 From: Swarsel Date: Sat, 10 Aug 2024 17:14:05 +0200 Subject: [PATCH] chore: debug nix-updates waybar indicator --- SwarselSystems.org | 16 ++++------------ pkgs/update-checker/default.nix | 3 ++- profiles/common/home/waybar.nix | 6 +----- scripts/update-checker.sh | 7 +------ 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/SwarselSystems.org b/SwarselSystems.org index f60424f..baee841 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -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= 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" = { diff --git a/pkgs/update-checker/default.nix b/pkgs/update-checker/default.nix index 6dd7d35..9459aba 100644 --- a/pkgs/update-checker/default.nix +++ b/pkgs/update-checker/default.nix @@ -1,6 +1,7 @@ -{ writeShellApplication, sway }: +{ writeShellApplication, nvd }: writeShellApplication { name = "update-checker"; + runtimeInputs = [ nvd ]; text = builtins.readFile ../../scripts/update-checker.sh; } diff --git a/profiles/common/home/waybar.nix b/profiles/common/home/waybar.nix index 2c91121..4acfde0 100644 --- a/profiles/common/home/waybar.nix +++ b/profiles/common/home/waybar.nix @@ -35,11 +35,7 @@ interval = 3600; tooltip = true; return-type = "json"; - format = "{} {icon} ?"; - format-icons = { - has-updates = ""; - updated = ""; - }; + format = "{} "; }; "group/hardware" = { diff --git a/scripts/update-checker.sh b/scripts/update-checker.sh index 3126d13..3b1ec24 100644 --- a/scripts/update-checker.sh +++ b/scripts/update-checker.sh @@ -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= 3) print $NF; }' ORS='\\n' ) fi -echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }" +echo "{ \"text\":\"$updates\", \"tooltip\":\"$tooltip\" }"