Compare commits

...
6 Commits
Author SHA1 Message Date
Daniele Fucini ae33917e8a Make fwupdmgr hint conditional
Only show fwupmgr hint if firmware updates are available
Also fold that and git-monitor hint in a single notification
2026-10-04 08:56:47 +02:00
Daniele Fucini eabaa962dc Update PKGBUILD 2026-10-03 21:26:31 +02:00
Daniele Fucini 3f2702eb71 Change timer frequency 2026-10-03 21:24:57 +02:00
Daniele Fucini 9f5c3b1cb4 Update PKGBUILD 2026-10-03 20:07:10 +02:00
Daniele Fucini 961ddc1e72 Fix state dir name 2026-10-03 20:04:47 +02:00
Daniele Fucini ae43e401a5 Update checksum 2026-10-03 20:02:07 +02:00
3 changed files with 26 additions and 16 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
# Maintainer: Daniele Fucini <dfucini [at] gmail [dot] com>
pkgname=update-notify
pkgver=2.0
pkgver=3.0.2
pkgrel=1
pkgdesc='Notify when updates are available'
arch=('any')
@@ -15,7 +15,7 @@ makedepends=('git')
optdepends=('git-monitor: to check git repos for updates')
source=(git+${url}?signed#tag=${pkgver})
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
sha256sums=('e96dbcc2b77750be03d89cdf3e1351c20c9079b7de1e129da0188dd3b30f6a03')
sha256sums=('3541f7b27a48316ba6cf7acb243cb50ae024ff139a39837ab78cb0ec9007efcd')
package()
{
Regular → Executable
+23 -13
View File
@@ -12,7 +12,7 @@ declare -A KERNELS=(
[linux-lts]="linux-lts-custom"
[linux-zen]="linux-zen-custom"
)
state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/check-updates"
state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/update-notify"
[[ $threshold =~ ^[0-9]+$ ]] || { echo "Threshold must be a number" >&2; exit 1; }
mkdir -p "$state_dir"
@@ -98,20 +98,30 @@ done
# General updates threshold
# ---------------------------------------------------------------------------
if (( updates >= threshold )); then
notify_once "updates" "Updates available" "Arch: $arch_updates, AUR: $aur_updates"
reminders=()
hints=(
"git-monitor|Check git packages|Use git-monitor for git packages updates"
"fwupdmgr|Check firmware|Use fwupdmgr to check for firmware updates"
)
for hint in "${hints[@]}"; do
IFS='|' read -r cmd title body <<< "$hint"
if command -v "$cmd" >/dev/null 2>&1; then
notify_once "hint-$cmd" "$title" "$body"
# Always remind about git packages if git-monitor is installed
if command -v git-monitor >/dev/null 2>&1; then
reminders+=("git-monitor")
fi
# Firmware: only mention it when updates actually exist.
# fwupdmgr get-updates exits 0 when updates are available, 2 when there are none.
# --no-metadata-check avoids prompting/refreshing; the fwupd-refresh timer keeps metadata fresh.
if command -v fwupdmgr >/dev/null 2>&1; then
timeout 30 fwupdmgr get-updates --no-metadata-check </dev/null >/dev/null 2>&1
if (( $? == 0 )); then
reminders+=("fwupdmgr (firmware updates available)")
fi
done
fi
body="Arch: $arch_updates, AUR: $aur_updates"
if (( ${#reminders[@]} )); then
printf -v list '%s, ' "${reminders[@]}"
body+=$'\n'"Also check: ${list%, }"
fi
notify_once "updates" "Updates available" "$body"
else
clear_state "updates"
clear_state "hint-git-monitor"
clear_state "hint-fwupdmgr"
fi
+1 -1
View File
@@ -3,7 +3,7 @@ Description=Run update-notify every 6 hours
[Timer]
OnBootSec=5min
OnUnitActiveSec=12h
OnUnitActiveSec=6h
Persistent=true
[Install]