mirror of
https://github.com/G2-Games/welcome.sh.git
synced 2025-04-19 05:22:53 -05:00
Fixed async update check, added more streamlined system
This commit is contained in:
parent
ccfb158843
commit
5335b5a6bb
2 changed files with 15 additions and 5 deletions
|
@ -9,7 +9,7 @@
|
||||||
greetings=("Welcome" "Greetings" "Hello" "Hi") # Add your own greetings!
|
greetings=("Welcome" "Greetings" "Hello" "Hi") # Add your own greetings!
|
||||||
randgreeting="off" #< Turn the random greetings on (eg. "Hello <user>, Hi <user>")
|
randgreeting="off" #< Turn the random greetings on (eg. "Hello <user>, Hi <user>")
|
||||||
twelvehour="on" #< Switch between 12 and 24 hour time (eg. 8:00 PM vs 20:00)
|
twelvehour="on" #< Switch between 12 and 24 hour time (eg. 8:00 PM vs 20:00)
|
||||||
rechargenotif="off" #< Notify that you should recharge if below 15%
|
rechargenotif="on" #< Notify that you should recharge if below 15%
|
||||||
updatecheck="on" #< Check for all updates, slows startup a bit
|
updatecheck="on" #< Check for all updates, slows startup a bit
|
||||||
flatpakupd="on" #< Check for flatpak updates, this slows startup down A LOT
|
flatpakupd="on" #< Check for flatpak updates, this slows startup down A LOT
|
||||||
goodgreeting="on" #< Display greetings like "Good afternoon," else "It's afternoon"
|
goodgreeting="on" #< Display greetings like "Good afternoon," else "It's afternoon"
|
||||||
|
|
18
welcome.sh
18
welcome.sh
|
@ -142,11 +142,19 @@ updates () {
|
||||||
if command -v flatpak &> /dev/null && [ "$flatpakupd" = "on" ]; then
|
if command -v flatpak &> /dev/null && [ "$flatpakupd" = "on" ]; then
|
||||||
flatpak=$(flatpak remote-ls --updates 2> /dev/null | wc -l)
|
flatpak=$(flatpak remote-ls --updates 2> /dev/null | wc -l)
|
||||||
fi
|
fi
|
||||||
|
# Add all update counts together
|
||||||
|
updates=$(($debian + $arch + $fedora + $flatpak + $brew))
|
||||||
|
echo $updates >| updates
|
||||||
pkill -P $pid sleep
|
pkill -P $pid sleep
|
||||||
|
sleep 5
|
||||||
|
if [ -a updates ]; then
|
||||||
|
rm updates
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
pid=$(echo $$)
|
pid=$(echo $$)
|
||||||
updchk &
|
updchk & #Check for updates Asynchronously
|
||||||
|
|
||||||
exec 3>&2
|
exec 3>&2
|
||||||
exec 2> /dev/null
|
exec 2> /dev/null
|
||||||
|
@ -155,8 +163,10 @@ updates () {
|
||||||
exec 2>&3
|
exec 2>&3
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
|
|
||||||
# Add all update counts together
|
if [ -a updates ]; then
|
||||||
updates=$(($debian + $arch + $fedora + $flatpak + $brew))
|
updates=$(cat updates)
|
||||||
|
rm updates
|
||||||
|
fi
|
||||||
|
|
||||||
# Check the update amounts and print them out
|
# Check the update amounts and print them out
|
||||||
if [ $chk -lt 1 ]; then
|
if [ $chk -lt 1 ]; then
|
||||||
|
@ -224,7 +234,7 @@ updatecheck="on" #< Check for general updates
|
||||||
flatpakupd="off" #< Check for flatpak updates, this slows startup down A LOT
|
flatpakupd="off" #< Check for flatpak updates, this slows startup down A LOT
|
||||||
goodgreeting="on" #< Display greetings like "Good afternoon," else "It's afternoon"
|
goodgreeting="on" #< Display greetings like "Good afternoon," else "It's afternoon"
|
||||||
|
|
||||||
source ~/.welcome/config.cfg
|
source config.cfg
|
||||||
|
|
||||||
welcome
|
welcome
|
||||||
greeting
|
greeting
|
||||||
|
|
Loading…
Reference in a new issue