vitorpy's Dotfiles
at main 33 lines 997 B view raw
1#!/bin/bash 2 3# Check for available pacman and AUR updates 4# Counts updates from official repos and AUR separately 5 6# Check official repo updates 7if command -v checkupdates &>/dev/null; then 8 official_updates=$(checkupdates 2>/dev/null | wc -l) 9else 10 # Fallback if pacman-contrib not installed 11 official_updates=$(pacman -Qu 2>/dev/null | wc -l) 12fi 13 14# Check AUR updates (if yay is available) 15if command -v yay &>/dev/null; then 16 aur_updates=$(yay -Qua 2>/dev/null | wc -l) 17else 18 aur_updates=0 19fi 20 21# Total updates 22total_updates=$((official_updates + aur_updates)) 23 24if [ "$total_updates" -gt 0 ]; then 25 if [ "$aur_updates" -gt 0 ]; then 26 tooltip="$official_updates official, $aur_updates AUR updates" 27 else 28 tooltip="$official_updates updates available" 29 fi 30 echo "{\"text\":\"\\uf02d $total_updates\", \"tooltip\":\"$tooltip\", \"class\":\"updates-available\"}" 31else 32 echo "{\"text\":\"\", \"tooltip\":\"System up to date\", \"class\":\"up-to-date\"}" 33fi