Replace aurman in polybar

Today I installed AL again. It’s grown since the last release. It look gorgious and works fine. One issue though. In a former release I could use pacli from polybar. Now the icon is linked to aurman but that does not do anything more than tell me my system is up to date. Question: is it possible to replace aurman with i.e. pamac in the polybar and if yes, how do I do that?

Edit the module in ~/.config/polybar/modules.conf

;;;;;;;;;
;; PKG ;;
;;;;;;;;;
[module/pkg]
type = custom/script
exec = updates.sh
exec-if = "ping -q -w 2 -c 1 176.34.135.167 > /dev/null"
label = %{A1:pamac-manager & disown:} %{A3:pamac-manager & disown:}%output%%{A} %{A}
tail = true

I believe the command for pamac is pamac-manager if not then edit as needed.

I really suggest you check the polybar wiki when you have questions like this in the future, they have done a great job of explaining everything and providing examples. For this question in particular see the action tag section https://github.com/jaagr/polybar/wiki/Formatting#action-a

2 Likes

You are right. I should have looked it up in the WiKi. I was a bit surprised that I could no longer install packages from the polybar like I used to in a former release. Now, the button only seems to notify me for updates. Pacman -S is great but if you want to look up a program, something like pamac is a must imo.

When there are updates available, clicking the icon will update the system.

There are a number of ways to open GUI applications, like jgmenu, rofi, adding a menu entry, etc.

I don’t use pamac so I’m not sure it’s a must, to use more robust searches with pacman use -Ssq, I use a small function in my zshrc.

pssq() {
    PS3="
Select package number: "
    select pkg in $(pacman -Ssq $1); do
        echo -e "\nChosen package: $pkg\n"
        sudo pacman -S $pkg
        break
    done
}

Average usage

~/.zsh → pssq neovim
1) neovim            2) python-neovim     3) python2-neovim

Select package: 1

Chosen package: neovim

[sudo] password for smoke:
warning: neovim-0.3.1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) neovim-0.3.1-1

Total Download Size:    4.39 MiB
Total Installed Size:  18.94 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 neovim-0.3.1-1-x86_64                                  4.4 MiB  6.79M/s 00:01 [--------------------------------------------] 100%
(1/1) checking keys in keyring                                                 [--------------------------------------------] 100%
(1/1) checking package integrity                                               [--------------------------------------------] 100%
(1/1) loading package files                                                    [--------------------------------------------] 100%
(1/1) checking for file conflicts                                              [--------------------------------------------] 100%
:: Processing package changes...
(1/1) reinstalling neovim                                                      [--------------------------------------------] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Updating the desktop file MIME type cache...

It could be easily adapted to use aurman instead but I rarely install from the AUR.

2 Likes

This is a great function. Thank you very much for taking the time to explain and share. This indeed makes pamac far less needed. Again: thank you.

2 Likes