Compare commits

..
2 Commits
Author SHA1 Message Date
Daniele Fucini ffb15c0954 Keep the configured threshold in the pending file
A threshold argument is a one-off override for the notification, so status bars
keep using THRESHOLD from the config.
2026-10-17 11:06:46 +02:00
Daniele Fucini da8505624f Update PKGBUILD 2026-10-17 10:57:34 +02:00
3 changed files with 14 additions and 8 deletions
+4 -3
View File
@@ -3,7 +3,7 @@
# Maintainer: Daniele Fucini <dfucini [at] gmail [dot] com>
pkgname=update-notify
pkgver=3.7
pkgver=3.8
pkgrel=1
pkgdesc='Notify when updates are available'
arch=('any')
@@ -14,10 +14,11 @@ depends=('pacman-contrib'
makedepends=('git')
optdepends=('aurutils: to check AUR packages in the local repo for updates'
'fwupd: to check for firmware updates'
'git-monitor: to check git repos for updates')
'git-monitor: to check git repos for updates'
'trustsight: to vet AUR updates before building them')
source=("git+$url?signed#tag=$pkgver")
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
sha256sums=('89ffddcb3fc0b82fdaec61defb374127d720655c35f2157cfe0d543360df22ab')
sha256sums=('947b6b33a9dd8fe69e87252d8a3591e99123d334f0e7660dcf13177ea8ba7746')
package()
{
+2 -2
View File
@@ -71,7 +71,7 @@ systemctl --user enable --now update-notify.path
update-notify [threshold]
```
`threshold` is the minimum number of updates (repo + AUR) before update counts are shown. It overrides the `THRESHOLD` setting below.
`threshold` is the minimum number of updates (repo + AUR) before update counts are shown. It overrides the `THRESHOLD` setting below for that run's notification only; the pending file keeps the configured value.
## Configuration
@@ -97,7 +97,7 @@ The content of the last notification is stored in `$XDG_STATE_HOME/update-notify
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
threshold <THRESHOLD from the config, not the argument>
repo <pkg> <newver>
aur <pkg> <newver>
kernel <custom-pkg> <stock-ver>
+8 -3
View File
@@ -19,10 +19,15 @@ if [[ -r $config_file ]]; then
# shellcheck source=/dev/null
source "$config_file"
fi
config_threshold=$THRESHOLD # written to the pending file, so a one-off argument doesn't change status bars
THRESHOLD=${1:-$THRESHOLD}
[[ $THRESHOLD =~ ^[0-9]+$ ]] || { echo "Threshold must be a number" >&2; exit 1; }
THRESHOLD=$((10#$THRESHOLD)) # force base 10, so e.g. "08" isn't read as octal
for t in "$config_threshold" "$THRESHOLD"; do
[[ $t =~ ^[0-9]+$ ]] || { echo "Threshold must be a number" >&2; exit 1; }
done
# force base 10, so e.g. "08" isn't read as octal
config_threshold=$((10#$config_threshold))
THRESHOLD=$((10#$THRESHOLD))
mkdir -p "$state_dir"
# notify-send from cron/systemd needs the session bus address
@@ -130,7 +135,7 @@ done
# Pending list for status bars, one "<source> <pkg> <newver>" per line
# ---------------------------------------------------------------------------
{
printf 'threshold %s\n' "$THRESHOLD"
printf 'threshold %s\n' "$config_threshold"
for item in "${arch_list[@]}"; do
read -r pkg _ _ new <<< "$item"
printf 'repo %s %s\n' "$pkg" "$new"