diff options
author | Adam <adam.moloney.stuck@gmail.com> | 2022-05-16 22:57:58 +0200 |
---|---|---|
committer | adamstuck <adam.moloney.stuck@gmail.com> | 2022-05-17 08:33:58 +0200 |
commit | 090fc9be62886f307f674c3de2b267fb87ad3e2f (patch) | |
tree | 2f55771d0554fa284e61a4b769c0b3460649b03b | |
parent | 3512cdbce2ae61603a9573d54d82709ce277051d (diff) |
polybar: show # of pacman and AUR updates
-rw-r--r-- | .config/polybar/config.ini | 8 | ||||
-rwxr-xr-x | .config/polybar/extra/updates-pacman-aurhelper.sh | 22 |
2 files changed, 29 insertions, 1 deletions
diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini index 3e1cdd1..e81ad51 100644 --- a/.config/polybar/config.ini +++ b/.config/polybar/config.ini @@ -44,7 +44,7 @@ font-2 = Font Awesome 5 Free Solid:size=14;4.5 modules-left = i3 modules-center = -modules-right = xkeyboard pulseaudio battery date +modules-right = updates-pacman-aurhelper xkeyboard pulseaudio battery date tray-maxsize = 22 tray-position = right @@ -172,6 +172,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 |