Add updates counter to polybar

This commit is contained in:
RealStickman 2021-01-30 14:06:01 +01:00
parent 872641e8b1
commit 88fab85c36
3 changed files with 34 additions and 1 deletions

View File

@ -16,6 +16,7 @@ include-file = /home/$USER/.config/polybar/colors.ini
include-file = /home/$USER/.config/polybar/modules/modules.ini
include-file = /home/$USER/.config/polybar/modules/i3.ini
include-file = /home/$USER/.config/polybar/modules/updates.ini
include-file = /home/$USER/.config/polybar/modules/xwindow.ini
include-file = /home/$USER/.config/polybar/modules/date.ini
#include-file = /home/$USER/.config/polybar/modules/volume.ini
@ -87,7 +88,7 @@ font-5 = Iosevka:style=Regular:size=16;3
modules-left = full sysmenu full i3 full left-top right-bot full xwindow full left-top
modules-center = right-bot full date full left-bot
modules-right = right-top full player-mpris-tail full left-bot right-top full battery full left-bot right-top
modules-right = right-top full player-mpris-tail full left-bot right-top full battery full left-bot right-top full updates-pacman-aurhelper full left-bot right-top
tray-detached = false

View File

@ -0,0 +1,10 @@
######################################################################
######################################################################
############ Updates ############
######################################################################
######################################################################
[module/updates-pacman-aurhelper]
type = custom/script
exec = ~/scripts/updates-pacman-aurhelper.sh
interval = 600

View File

@ -0,0 +1,22 @@
#!/bin/sh
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
# if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
if ! updates_aur=$(paru -Qum 2> /dev/null | wc -l); then
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
# if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
# if ! updates_aur=$(pikaur -Qua 2> /dev/null | wc -l); then
# if ! updates_aur=$(rua upgrade --printonly 2> /dev/null | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo "# $updates"
else
echo ""
fi