diff --git a/assets/hyprland-install/actions.sh b/assets/hyprland-install/actions.sh index 61459c1..c98b6ee 100755 --- a/assets/hyprland-install/actions.sh +++ b/assets/hyprland-install/actions.sh @@ -31,23 +31,21 @@ while true; do case $choice in 1) - printf "\n${OK} You chose non-git version of Hyprland....... executing...\n" + printf "\n${OK} You chose ${BLUE}non-git version of Hyprland${RESET}....... executing...\n" echo -e "${YELLOW} Uninstalling some hyprland packages first...${RESET}" - ./scripts/uninstall.sh - echo -e "${NOTE} Installing non-git version of Hyprland...${RESET}" + ./scripts/uninstall.sh && ./scripts/install-hyprland.sh break ;; 2) - printf "\n${OK} You chose git version of Hyprland....... executing...\n" + printf "\n${OK} You chose ${BLUE}git version of Hyprland${RESET}....... executing...\n" echo -e "${YELLOW} Uninstalling some hyprland packages....${RESET}" - ./scripts/uninstall.sh - echo -e "${NOTE} Installing git version of Hyprland...${RESET}" + ./scripts/uninstall.sh && ./scripts/install-hyprland-git.sh break ;; 3) - echo -e "${MAGENTA} You chose to cancel. Good Bye!!...${RESET}" + echo -e "${MAGENTA} You have cancel it. Good Bye!!...${RESET}" printf "\n%.0s" {1..2} break ;; diff --git a/assets/hyprland-install/scripts/install-hyprland-git.sh b/assets/hyprland-install/scripts/install-hyprland-git.sh index 655c074..0c98c69 100755 --- a/assets/hyprland-install/scripts/install-hyprland-git.sh +++ b/assets/hyprland-install/scripts/install-hyprland-git.sh @@ -38,13 +38,20 @@ packages=( "pyprland" ) -# Function that would show a progress bar to the user +# rotating stars progress show_progress() { + spin='-' while ps | grep $1 &> /dev/null; do - echo -n "." - sleep 1 + echo -ne "\rInstalling ${ORANGE}$2${RESET} ... Kindly wait! $spin" + sleep 0.3 + case $spin in + '-') spin='\';; + '\') spin='|';; + '|') spin='/';; + '/') spin='-';; + esac done - echo -en "Done!" + echo -en "\rInstalling ${ORANGE}$2${RESET} ... Kindly wait! .... Done!" } # Clearing cache @@ -53,26 +60,19 @@ printf "\n%.0s" {1..1} sudo pacman -Scc && $ISAUR -Scc +printf "\n%.0s" {1..1} +printf "${NOTE} Installing ${BLUE}git hyprland version${RESET}....." printf "\n%.0s" {1..1} # Installing packages for package in "${packages[@]}"; do - echo -n "Installing ${ORANGE}$package${RESET} ... ${BLUE}Kindly wait!${RESET} " - - # Show progress dots and installation result on a new line - echo -n "..." - - # Install the package in the background and capture its PID $ISAUR -S --noconfirm --needed "$package" &>/dev/null & pid=$! - # Start the progress bar in the background - show_progress $pid + show_progress $pid $package - # Wait for the package installation to finish wait $pid - # Check the result of the installation if [ $? -eq 0 ]; then echo -e "\n${OK} ${ORANGE}$package${RESET} successfully installed." printf "\n%.0s" {1..1} diff --git a/assets/hyprland-install/scripts/install-hyprland.sh b/assets/hyprland-install/scripts/install-hyprland.sh index 5d3f46c..5df8092 100755 --- a/assets/hyprland-install/scripts/install-hyprland.sh +++ b/assets/hyprland-install/scripts/install-hyprland.sh @@ -38,32 +38,35 @@ packages=( "pyprland" ) -# Function that would show a progress bar to the user +# rotating stars progress show_progress() { + spin='-' while ps | grep $1 &> /dev/null; do - echo -n "." - sleep 1 + echo -ne "\rInstalling ${ORANGE}$2${RESET} ... Kindly wait! $spin" + sleep 0.3 + case $spin in + '-') spin='\';; + '\') spin='|';; + '|') spin='/';; + '/') spin='-';; + esac done - echo -en "Done!" + echo -en "\rInstalling ${ORANGE}$2${RESET} ... Kindly wait! .... Done!" } + +printf "\n%.0s" {1..1} +printf "${NOTE} Installing ${BLUE}non-git hyprland version${RESET}....." +printf "\n%.0s" {1..1} + # Installing packages for package in "${packages[@]}"; do - echo -n "Installing ${ORANGE}$package${RESET} ... ${BLUE}Kindly wait!${RESET} " - - # Show progress dots and installation result on a new line - echo -n "..." - - # Install the package in the background and capture its PID $ISAUR -S --noconfirm --needed "$package" &>/dev/null & pid=$! - # Start the progress bar in the background - show_progress $pid + show_progress $pid $package - # Wait for the package installation to finish wait $pid - # Check the result of the installation if [ $? -eq 0 ]; then echo -e "\n${OK} ${ORANGE}$package${RESET} successfully installed." printf "\n%.0s" {1..1} @@ -75,4 +78,4 @@ done printf "\n%.0s" {1..1} printf "${OK} Done!! Now you NEED to ${YELLOW}EXIT${RESET} Hyprland and Re-Login! Enjoy!!!!" -printf "\n%.0s" {1..2} +printf "\n%.0s" {1..2} \ No newline at end of file