Each run saves the pending repo, AUR and kernel updates to $XDG_STATE_HOME/update-notify/pending, independent of the threshold, so a status bar can show them and drop the ones installed since.
3.3 KiB
update-notify
Desktop notifications for pending updates on Arch Linux.
update-notify runs on a systemd user timer and checks:
- Repo updates, using
checkupdatesfrom pacman-contrib. - AUR updates for packages in a local aurutils repository (
aur repo -u). - Custom kernel rebuilds: when a stock kernel (e.g.
linux-lts) has a newer version than your custom build of it (e.g.linux-lts-custom).
It sends one notification, and only when its content changes since the last one:
- Update counts are shown once the total number of updates reaches a threshold (default 30). Reminders for
git-monitorand pending firmware updates (fwupdmgr) are added when those tools are installed. - Kernel rebuild reminders are always shown, even below the threshold.
Requirements
pacman-contriblibnotifyand a running notification daemon
Optional:
aurutils: check AUR packages in the local repositoryfwupd: check for firmware updatesgit-monitor: remind to check git packages
Installation
Build and install the package with the included PKGBUILD:
makepkg -si
Or, with aurutils, build it into your local repository with aur build and install it with pacman.
Then enable the timer:
systemctl --user enable --now update-notify.timer
The timer runs 5 minutes after boot, then every 6 hours.
Usage
update-notify [threshold]
threshold is the minimum number of updates (repo + AUR) before update counts are shown. It overrides the THRESHOLD setting below.
Configuration
Settings are read from $XDG_CONFIG_HOME/update-notify/config (default ~/.config/update-notify/config), a bash file that is sourced by the script. All settings are optional:
THRESHOLD: minimum number of updates before update counts are shown (default 30).AUR_REPO: name of the local aurutils repository (defaultaur-local).KERNELS: maps each stock kernel package to its custom build (default:linux,linux-ltsandlinux-zento<name>-custom). Kernels where either package isn't installed are skipped. SetKERNELS=()to disable the kernel check.
A commented sample config is installed with the package. To start from it:
mkdir -p ~/.config/update-notify
cp /usr/share/doc/update-notify/config.example ~/.config/update-notify/config
Kernel versions are compared without pkgrel, so a stock packaging-only update doesn't trigger a rebuild reminder. A custom build already in the local repository but not installed yet counts as up to date.
The content of the last notification is stored in $XDG_STATE_HOME/update-notify (default ~/.local/state/update-notify). Delete it to get the current notification again.
Status bars
Each run also writes the pending updates to $XDG_STATE_HOME/update-notify/pending, whether or not the threshold is reached, for status bars such as xmobar to read:
threshold 30
repo <pkg> <newver>
aur <pkg> <newver>
kernel <custom-pkg> <stock-ver>
The file reflects the last run. To keep a bar current after an upgrade, drop entries whose installed version (pacman -Q) is no longer older than newver, or, for kernel lines, whose custom build has caught up with stock-ver (ignoring pkgrel). This only reads local data, so it's cheap to run often.
License
GPL-3.0-or-later. See LICENSE.