From 16dfa0c16000561535b2d945bb1ba4b13af5897f Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 23 Dec 2020 15:52:45 +0100 Subject: [PATCH] test tooltip for pkg module --- roles/waybar/files/waybar/modules/pkg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/waybar/files/waybar/modules/pkg.sh b/roles/waybar/files/waybar/modules/pkg.sh index 9a08f18..91c5b8c 100755 --- a/roles/waybar/files/waybar/modules/pkg.sh +++ b/roles/waybar/files/waybar/modules/pkg.sh @@ -19,16 +19,16 @@ pacman_check() { } xbps_check(){ - pkg=$(xbps-install -nu) + pkg=$(xbps-install -nu 2>/dev/null) pkg_count=$(wc -l <<< "$pkg") - if [[ $pkg -eq "0" ]] || [[ ! $pkg =~ [0-9]+ ]] + if [[ $pkg_count -eq "0" ]] || [[ ! $pkg =~ [0-9]+ ]] then exit 0 fi text=" $pkg_count" tooltip=$(awk '{print $1}' <<< "$pkg") - printf {"text": "$text", "tooltip": "$tooltip"} + printf '{"text": "%s", "tooltip": "%s"}' "$text" "$tooltip" } if grep -i "arch" /etc/os-release &>/dev/null