29 lines
		
	
	
		
			665 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			665 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env dash
 | 
						|
 | 
						|
. $(dirname $0)/../panel-config
 | 
						|
 | 
						|
updtmp=/tmp/update-count
 | 
						|
touch "$updtmp"
 | 
						|
 | 
						|
list=$(checkupdates; cower -u)
 | 
						|
if [ -n "$list" ]; then
 | 
						|
    num=$(echo "$list" | wc -l)
 | 
						|
else
 | 
						|
    num=0
 | 
						|
fi
 | 
						|
if [ "$num" -gt 0 ]; then
 | 
						|
    lastnum=$(cat $updtmp)
 | 
						|
    if [ "$num" -ne "${lastnum:-0}" ]; then
 | 
						|
        echo "$num" > "$updtmp"
 | 
						|
        if [ "$num" -gt "${lastnum:-0}" ]; then
 | 
						|
            notify-send --icon="system-run" "$(( $num - $lastnum )) new update(s) available" "\n$list"
 | 
						|
            aplay -N -q /usr/share/sounds/ding.wav
 | 
						|
        fi
 | 
						|
    fi
 | 
						|
    echo "U%{F${COLOR_2}}$ICON_UPD $num%{F-}"
 | 
						|
else
 | 
						|
    echo "U%{F${COLOR_DIM}}$ICON_UPD%{F-}"
 | 
						|
fi
 | 
						|
 | 
						|
# vim:set ft=sh:
 |