From 7d568cb97f41ef027a834e1252c0703c52cdd050 Mon Sep 17 00:00:00 2001 From: Adam <56338480+adastx@users.noreply.github.com> Date: Mon, 16 May 2022 22:57:58 +0200 Subject: polybar: show # of pacman and AUR updates --- .config/polybar/config.ini | 12 +++++++++--- .config/polybar/extra/updates-pacman-aurhelper.sh | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100755 .config/polybar/extra/updates-pacman-aurhelper.sh (limited to '.config/polybar') diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini index fce776b..8a2b759 100644 --- a/.config/polybar/config.ini +++ b/.config/polybar/config.ini @@ -39,12 +39,12 @@ module-margin-right = 2 padding-right = 1 font-0 = Averia Libre:style=bold:size=15;3.8 -font-1 = Font Awesome 5 Free Regular:size=14;4.5 -font-2 = Font Awesome 5 Free Solid:size=14;4.5 +font-1 = Font Awesome 5 Free Solid:size=14;4.5 +font-2 = Font Awesome 5 Free Regular:size=14;4.5 modules-left = i3 modules-center = -modules-right = xkeyboard pulseaudio date +modules-right = updates-pacman-aurhelper xkeyboard pulseaudio date tray-maxsize = 25 tray-position = right @@ -191,6 +191,12 @@ label-muted-foreground = #999 label-muted-background = ${colors.background-module} +[module/updates-pacman-aurhelper] +type = custom/script +exec = /home/adam/.config/polybar/extra/updates-pacman-aurhelper.sh +interval = 600 +format-foreground = ${root.foreground} +; format-background = ${colors.background-module} [settings] screenchange-reload = true diff --git a/.config/polybar/extra/updates-pacman-aurhelper.sh b/.config/polybar/extra/updates-pacman-aurhelper.sh new file mode 100755 index 0000000..ec5cb53 --- /dev/null +++ b/.config/polybar/extra/updates-pacman-aurhelper.sh @@ -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 -- cgit v1.2.3-70-g09d2