Do I need to change anything about polybar's update notification module if I switch AUR helper?

hi, I’m new here and I hope this is the right category for this question - I was wondering about the polybar “pkg” module that displays pacman+AUR update notifications. does it work properly with any AUR helper and pacman interface I have installed? because I just switched to pacUI and trizen, and it seems to be working (at least it displays the same number of updates as Pamac does), except of course for the pacli terminal window that used to open when I clicked on the update notifications, I guess I’ll have to change that manually to pacUI - is there anything else I need to update in the configs?
sorry for the noob question, I’m just a bit paranoid about missing something super obvious that’ll end up causing problems in the future :sweat:
thanks!

It doesn’t check AUR packages you have installed, it only uses pacman. The main reason we don’t have it by default is performance and everyone uses different helpers, almost all of them are themselves in the AUR, we already have yaourt and pacli :stuck_out_tongue:

You can edit the script ~/bin/updates.sh and add functionality for whichever helper you prefer, this should work for trizen

#!/usr/bin/env bash

BAR_ICON=""
ICON=/usr/share/icons/gnome/32x32/apps/system-software-update.png

while true; do
    main=$(checkupdates | wc -l)
    aur=$(trizen -Su --aur --quiet | wc -l)  # edit with your preferred helper
    updates=$((main + aur))

    if hash notify-send &>/dev/null; then
        if [[ $updates -gt 50 ]]; then
            notify-send -u critical -i $ICON \
                        "You really need to update soon!!" "$updates New package updates"
        elif [[ $updates -gt 25 ]]; then
            notify-send -u normal -i $ICON \
                        "You should update soon" "$updates New package updates"
        elif [[ $updates -gt 2 ]]; then
            notify-send -u low -i $ICON "$updates New package updates"
        fi
    fi

    while [[ $updates -gt 0 ]]; do
        if [[ $updates -eq 1 ]]; then
            echo "$updates Update"
        elif [[ $updates -gt 1 ]]; then
            echo "$updates Updates"
        fi
        sleep 15
        main=$(checkupdates | wc -l)
        aur=$(trizen -Su --aur --quiet | wc -l)  # edit with your preferred helper
        updates=$((main + aur))
    done

    while [[ $updates -eq 0 ]]; do
        echo $BAR_ICON
        main=$(checkupdates | wc -l)
        aur=$(trizen -Su --aur --quiet | wc -l)  # edit with your preferred helper
        updates=$((main + aur))
        sleep 1600
    done
done

To change what opens when the icon is clicked you will need to edit ~/.config/polybar/modules.conf (lines 203-208)

The default

[module/pkg]
type = custom/script
exec = updates.sh
exec-if = "ping -q -w 2 -c 1 176.34.135.167 > /dev/null"

; this is the line you need to change
label = %{A1:termite --exec=pacli & disown:} %{A3:termite --exec=pacli & disown:}%output%%{A} %{A}

; try this instead.. Don't forget to comment the original line with a semicolon ;
label = %{A1:pacui &:} %{A3:pacui &:}%output%%{A} %{A}

tail = true

Hope this helps

Cheers

2 Likes

aah that’s what I meant when I worried about missing something obvious :laughing: good thing I’m so OCD I’ve updated the AUR every time I opened pacli to up install pacman updates.

Thank you for your help, seems to work now!

1 Like