Pacman Post Transaction PackageKit Hook

As an Arch Linux user, I find it very inconvenient that pkcon refresh must be run every time after sudo pacman -Syu in order to hide the update notifier in the system tray

Fortunately, there is a simple solution for this problem. Create 90-refresh-packagekit.hook file in /etc/pacman.d/hooks/ with the following contents

Type = Package
Operation = Install
Operation = Upgrade
Target = *

Description = Refresh PackageKit
Depends = packagekit
Depends = systemd
When = PostTransaction
Exec = /usr/bin/busctl call --system org.freedesktop.PackageKit /org/freedesktop/PackageKit org.freedesktop.PackageKit StateHasChanged s posttrans

Now, when you update the system using sudo pacman -Syu, the update notifier icon will be hidden automagically.

EDIT(3/14/2021): Since was merged, you don’t need to create any post transaction hooks anymore.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s