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

[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
Target = *

[Action]
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 https://github.com/hughsie/PackageKit/pull/459 was merged, you don’t need to create any post transaction hooks anymore.

Leave a Reply