From 9cbbe21f831438ef663401f2f22fd253f66df4a7 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 23 Dec 2020 14:41:44 +0100 Subject: [PATCH] updated module pkg waybar --- roles/waybar/files/waybar/modules/pkg.sh | 43 ++++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/roles/waybar/files/waybar/modules/pkg.sh b/roles/waybar/files/waybar/modules/pkg.sh index 785e8bf..b136a50 100755 --- a/roles/waybar/files/waybar/modules/pkg.sh +++ b/roles/waybar/files/waybar/modules/pkg.sh @@ -1,16 +1,37 @@ #!/bin/bash -pac=$(checkupdates 2>/dev/null | wc -l) -aur=$(trizen -Qua 2>/dev/null | wc -l) -if [[ $pac -eq "0" ]] && [[ $aur -eq "0" ]] || [[ ! $pac =~ [0-9]+ ]] || [[ ! $aur =~ [0-9]+ ]] -then - exit 0 -fi +pacman_check() { + pac=$(checkupdates 2>/dev/null | wc -l) + aur=$(trizen -Qua 2>/dev/null | wc -l) + + if [[ $pac -eq "0" ]] && [[ $aur -eq "0" ]] || [[ ! $pac =~ [0-9]+ ]] || [[ ! $aur =~ [0-9]+ ]] + then + exit 0 + fi + + if [[ $(checkupdates | grep '^linux\ ') ]] + then + echo "$pac $aur" + else + #echo "$pac %{F#5b5b5b}%{F-} $aur" + echo "$pac $aur" + fi +} -if [[ $(checkupdates | grep '^linux\ ') ]] +xbps_check(){ + pkg=(xbps-install -nu | wc -l) + + if [[ $pkg -eq "0" ]] || [[ ! $pkg =~ [0-9]+ ]] + then + exit 0 + fi + echo " $pkg" ■ +} + +if grep -i "arch" /etc/os-release then - echo "$pac $aur" -else - #echo "$pac %{F#5b5b5b}%{F-} $aur" - echo "$pac $aur" + pacman_check +elif grep -i "void" /etc/os-release +then + xbps_check fi