aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/pacsync
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2026-11-11 19:47:52 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2026-11-11 19:47:52 +0300
commitda24f0ab7630c3a26381a4bdf1534169b88cb354 (patch)
tree4bb164f8393145ed6f279dec2d8a231a082175b9 /dotfiles/.local/bin/pacsync
parentdb1c45b344e02b0f4b89e15355a183d02c8f43e5 (diff)
downloadswayrice-da24f0ab7630c3a26381a4bdf1534169b88cb354.tar.gz
swayrice-da24f0ab7630c3a26381a4bdf1534169b88cb354.zip
mailsync, pacsync: update notificationsniri
Use icons, be transient, etc.
Diffstat (limited to 'dotfiles/.local/bin/pacsync')
-rwxr-xr-xdotfiles/.local/bin/pacsync14
1 files changed, 9 insertions, 5 deletions
diff --git a/dotfiles/.local/bin/pacsync b/dotfiles/.local/bin/pacsync
index 2e5d60f..15f2c97 100755
--- a/dotfiles/.local/bin/pacsync
+++ b/dotfiles/.local/bin/pacsync
@@ -8,6 +8,9 @@ if pidof pacman; then
exit
fi
+napp="System upgrade"
+ni="preferences-system-linux"
+
# Check several times before giving up, useful when just waking up from sleep
# since internet is usually not available right away
wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
@@ -15,19 +18,20 @@ wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
# Source the needed env variables so that it can function properly from cron
. ~/.cache/sessionenv
-notify-send " System upgrade" "Syncing repositories and downloading packages..."
+notify-send -a "$napp" -i "$ni" -e "Syncing repositories and downloading packages..."
touch ~/.cache/pacsynclive
killall -41 waybar
-sudo pacman -Syuw --noconfirm || notify-send " System upgrade" \
- "Error downloading updates. Check your internet connection or that you have the required permissions"
+if ! sudo pacman -Syuw --noconfirm; then
+ notify-send -a "$napp" -i "$ni" -u critical -t 3000 "Error downloading updates.
+fi
rm -f ~/.cache/pacsynclive
killall -41 waybar
upno=$(pacman -Qu | wc -l)
-if [ $upno -lt 0 ]; then
- notify-send " System upgrade" "Repository sync finished. $upno updates are available"
+if [ $upno -gt 0 ]; then
+ notify-send -a "$napp" -i "$ni" "Repository sync finished. $upno updates are available"
fi