mirror of
https://github.com/xsghetti/HyprCrux.git
synced 2025-07-03 13:50:38 -04:00
41 lines
868 B
Bash
41 lines
868 B
Bash
!/usr/bin/env bash
|
|
|
|
# Check release
|
|
if [ ! -f /etc/arch-release ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
# source variables
|
|
ScrDir=`dirname "$(realpath "$0")"`
|
|
source $ScrDir/globalcontrol.sh
|
|
|
|
# Check for updates
|
|
get_aurhlpr
|
|
aur=`${aurhlpr} -Qua | wc -l`
|
|
ofc=`checkupdates | wc -l`
|
|
|
|
# Check for flatpak updates
|
|
if pkg_installed flatpak ; then
|
|
fpk=`flatpak remote-ls --updates | wc -l`
|
|
fpk_disp="\n Flatpak $fpk"
|
|
fpk_exup="; flatpak update"
|
|
else
|
|
fpk=0
|
|
fpk_disp=""
|
|
fi
|
|
|
|
# Calculate total available updates
|
|
upd=$(( ofc + aur + fpk ))
|
|
|
|
# Show tooltip
|
|
if [ $upd -eq 0 ] ; then
|
|
echo "{\"text\":\"$upd\", \"tooltip\":\" Packages are up to date\"}"
|
|
else
|
|
echo "{\"text\":\"$upd\", \"tooltip\":\" Official $ofc\n AUR $aur$fpk_disp\"}"
|
|
fi
|
|
|
|
# Trigger upgrade
|
|
if [ "$1" == "up" ] ; then
|
|
kitty --title systemupdate sh -c "${aurhlpr} -Syu $fpk_exup"
|
|
fi
|
|
|