Files
dotfiles/hypr/scripts/update-sys.sh
2026-08-23 14:31:43 -07:00

25 lines
836 B
Bash
Executable File

#!/usr/bin/env bash
# If 'up' argument is passed, run update in terminal
if [ "$1" == "up" ]; then
ghostty -e bash -c "yay -Syu && flatpak update; echo 'Done. Press Enter.'; read"
exit 0
fi
# Otherwise, do a quick parallel check
notify-send "Checking Updates..." -t 1500
# Check Pacman, AUR, and Flatpaks in parallel
pc_count=$(checkupdates 2>/dev/null | wc -l) &
aur_count=$(yay -Qua 2>/dev/null | wc -l) &
fp_count=$(flatpak remote-ls --updates 2>/dev/null | wc -l) &
wait
total=$((pc_count + aur_count + fp_count))
if [ "$total" -eq 0 ]; then
notify-send "System Up to Date" "No packages to update." -i checkbox-checked-symbolic
else
notify-send "Updates Available" "󰚰 Total: $total\nRepo: $pc_count | AUR: $aur_count | Flatpak: $fp_count\n\nPress SUPER+U to update." -i software-update-available-symbolic
fi