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.