From bfbbbd2e52919ea64234d0753f944605e4b1ef64 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 3 Feb 2025 01:59:04 +0900 Subject: [PATCH] change progress animation --- install-scripts/Global_functions.sh | 23 +++++++++++++---------- preset.sh | 4 +--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/install-scripts/Global_functions.sh b/install-scripts/Global_functions.sh index bb0ff7e..e866eac 100755 --- a/install-scripts/Global_functions.sh +++ b/install-scripts/Global_functions.sh @@ -29,19 +29,20 @@ fi show_progress() { local pid=$1 local package_name=$2 - local dots="" - - # Print initial message only once - echo -ne "${NOTE} Installing ${YELLOW}$package_name${RESET} ..." + local spin_chars=("|" "/" "-" "\\") # Classic spinner + local i=0 + + tput civis # Hide cursor + printf "\r${NOTE} Installing ${YELLOW}%s${RESET} ..." "$package_name" - # Loop until the process is running while ps -p $pid &> /dev/null; do - dots+="." - printf "\r%-80s" "${NOTE} Installing ${YELLOW}$package_name${RESET} ...$dots" - sleep 1 + printf "\r${NOTE} Installing ${YELLOW}%s${RESET} %s" "$package_name" "${spin_chars[i]}" + i=$(( (i + 1) % 4 )) + sleep 0.2 # Faster animation done - - printf "\r%-80s\n" "${NOTE} Installing ${YELLOW}$package_name${RESET} ... Done!" + + printf "\r${NOTE} Installing ${YELLOW}%s${RESET} ... Done!%-20s\n" "$package_name" "" + tput cnorm # Show cursor again } @@ -50,6 +51,7 @@ install_package_pacman() { # Check if package is already installed if pacman -Q "$1" &>/dev/null ; then echo -e "${OK} ${MAGENTA}$1${RESET} is already installed. Skipping..." + printf "\n%.0s" {1..1} else # Run pacman and redirect all output to a log file ( @@ -75,6 +77,7 @@ install_package() { # Checking if package is already installed if $ISAUR -Q "$1" &>> /dev/null ; then echo -e "${OK} ${MAGENTA}$1${RESET} is already installed. Skipping..." + printf "\n%.0s" {1..1} else # Run yay/paru and redirect all output to a log file ( diff --git a/preset.sh b/preset.sh index 08f7f2b..e810a19 100644 --- a/preset.sh +++ b/preset.sh @@ -9,7 +9,6 @@ ### -Type AUR helper ### yay or paru aur_helper="yay" -############ use : "Y" or "N" ###-Do you have any nvidia gpu in your system? nvidia="Y" ###-Install GTK themes (required for Dark/Light function)? @@ -34,8 +33,7 @@ dots="Y" ### These are the sub-questions of the above choices ### Would you like to blacklist nouveau? (y/n) blacklist_nouveau="Y" -# Ask the user if they want to use Thunar as the default file manager -# Do you want to set Thunar as the default file manager? (y/n): " +### Do you want to set Thunar as the default file manager? (y/n): " thundefault="Y" ### OPTIONAL - Would you like to install SDDM themes? (y/n) install_sddm_theme="Y"