change progress bar to growing and shrinking dots

This commit is contained in:
JaKooLit
2025-02-03 02:05:01 +09:00
parent bfbbbd2e52
commit 29cc1c3f52

View File

@@ -25,11 +25,11 @@ if [ ! -d Install-Logs ]; then
mkdir Install-Logs mkdir Install-Logs
fi fi
# Function that would show a progress bar # Function that would show a progress
show_progress() { show_progress() {
local pid=$1 local pid=$1
local package_name=$2 local package_name=$2
local spin_chars=("|" "/" "-" "\\") # Classic spinner local spin_chars=("●○○○" "○●○○" "○○●○" "○○○●" "○○●○" "○●○○") # Dots Growing & Shrinking
local i=0 local i=0
tput civis # Hide cursor tput civis # Hide cursor
@@ -37,8 +37,8 @@ show_progress() {
while ps -p $pid &> /dev/null; do while ps -p $pid &> /dev/null; do
printf "\r${NOTE} Installing ${YELLOW}%s${RESET} %s" "$package_name" "${spin_chars[i]}" printf "\r${NOTE} Installing ${YELLOW}%s${RESET} %s" "$package_name" "${spin_chars[i]}"
i=$(( (i + 1) % 4 )) i=$(( (i + 1) % 6 ))
sleep 0.2 # Faster animation sleep 0.2
done done
printf "\r${NOTE} Installing ${YELLOW}%s${RESET} ... Done!%-20s\n" "$package_name" "" printf "\r${NOTE} Installing ${YELLOW}%s${RESET} ... Done!%-20s\n" "$package_name" ""
@@ -46,6 +46,7 @@ show_progress() {
} }
# Function to install packages with pacman # Function to install packages with pacman
install_package_pacman() { install_package_pacman() {
# Check if package is already installed # Check if package is already installed
@@ -62,7 +63,7 @@ install_package_pacman() {
# Double check if package is installed # Double check if package is installed
if pacman -Q "$1" &>/dev/null ; then if pacman -Q "$1" &>/dev/null ; then
echo -e "\n${OK} Package ${YELLOW}$1${RESET} has been successfully installed!" echo -e "${OK} Package ${YELLOW}$1${RESET} has been successfully installed!"
else else
echo -e "\n${ERROR} ${YELLOW}$1${RESET} failed to install. Please check the $LOG. You may need to install manually." echo -e "\n${ERROR} ${YELLOW}$1${RESET} failed to install. Please check the $LOG. You may need to install manually."
exit 1 exit 1
@@ -88,7 +89,7 @@ install_package() {
# Double check if package is installed # Double check if package is installed
if $ISAUR -Q "$1" &>> /dev/null ; then if $ISAUR -Q "$1" &>> /dev/null ; then
echo -e "\n${OK} Package ${YELLOW}$1${RESET} has been successfully installed!" echo -e "${OK} Package ${YELLOW}$1${RESET} has been successfully installed!"
else else
# Something is missing, exiting to review log # Something is missing, exiting to review log
echo -e "\n${ERROR} ${YELLOW}$1${RESET} failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" echo -e "\n${ERROR} ${YELLOW}$1${RESET} failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :("