From 246266f5822669c5ecd94af7081d66725464472e Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Wed, 3 Jul 2024 10:23:17 +0900 Subject: [PATCH] adjusted copy.sh for kb_layout and Rainbow Borders disabling --- copy.sh | 256 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 156 insertions(+), 100 deletions(-) diff --git a/copy.sh b/copy.sh index e828348..d80476a 100755 --- a/copy.sh +++ b/copy.sh @@ -36,6 +36,11 @@ if [ ! -d Copy-Logs ]; then mkdir Copy-Logs fi +# Function to print colorful text +print_color() { + printf "%b%s%b\n" "$1" "$2" "$CLEAR" +} + # Set the name of the log file to include the current date and time LOG="Copy-Logs/install-$(date +%d-%H%M%S)_dotfiles.log" @@ -91,61 +96,88 @@ detect_layout() { layout=$(detect_layout) if [ "$layout" = "(unset)" ]; then - while true; do - printf "\n%.0s" {1..1} - echo "$(tput bold)$(tput setaf 3)ATTENTION!!!! VERY IMPORTANT!!!! $(tput sgr0)" - echo "$(tput bold)$(tput setaf 1)The keyboard layout could not be detected properly. $(tput sgr0)" - echo "$(tput bold)$(tput setaf 7)You need to set it manually. $(tput sgr0)" - echo "$(tput bold)$(tput setaf 2)If you are not sure, type us. You can change later on! $(tput sgr0)" - printf "\n%.0s" {1..1} - echo "$(tput bold)$(tput setaf 5)You can also set more than 2 layouts!$(tput sgr0)" - echo "$(tput bold)$(tput setaf 5)ie: us,kr,es $(tput sgr0)" - printf "\n%.0s" {1..1} - read -p "${CAT} - Please enter the correct keyboard layout: " new_layout - - if [ -n "$new_layout" ]; then - layout="$new_layout" - break - else - echo "Please enter a keyboard layout." - fi - done + while true; do + printf "\n%.0s" {1..1} +print_color $RED " +█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█ + STOP AND READ +█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ + + !!! IMPORTANT WARNING !!! + +The Default Keyboard Layout could not be detected + +You need to set it Manually + +!!! WARNING !!! +Setting a wrong Keyboard Layout will cause Hyprland to crash + +If you are not sure, just type us + +NOTE: +• You can also set more than 2 keyboard layouts +• For example us,kr,gb,ru +" + printf "\n%.0s" {1..1} + read -p "${CAT} - Please enter the correct keyboard layout: " new_layout + + if [ -n "$new_layout" ]; then + layout="$new_layout" + break + else + echo "Please enter a keyboard layout." + fi + done fi printf "${NOTE} Detecting keyboard layout to prepare proper Hyprland Settings\n\n" # Prompt the user to confirm whether the detected layout is correct while true; do - read -p "$ORANGE Current keyboard layout is: $layout. Is this correct? [y/n] " confirm - - case $confirm in - [yY]) - # If the detected layout is correct, update the 'kb_layout =' line in the file - awk -v layout="$layout" '/kb_layout/ {$0 = " kb_layout = " layout} 1' config/hypr/UserConfigs/UserSettings.conf > temp.conf - mv temp.conf config/hypr/UserConfigs/UserSettings.conf - - echo "${NOTE} kb_layout $layout configured in settings. " 2>&1 | tee -a "$LOG" - break ;; - [nN]) - printf "\n%.0s" {1..2} - echo "$(tput bold)$(tput setaf 3)ATTENTION!!!! VERY IMPORTANT!!!! $(tput sgr0)" - echo "$(tput bold)$(tput setaf 1)Setting a wrong value here will result in Hyprland not starting $(tput sgr0)" - echo "$(tput bold)$(tput setaf 2)If you are not sure, type us. You can change later on! $(tput sgr0)" - printf "\n%.0s" {1..1} - echo "$(tput bold)$(tput setaf 5)You can also set more than 2 layouts!$(tput sgr0)" - echo "$(tput bold)$(tput setaf 5)ie: us,kr,es $(tput sgr0)" - printf "\n%.0s" {1..1} - - read -p "${CAT} - Please enter the correct keyboard layout: " new_layout - - # Update the 'kb_layout =' line with the correct layout in the file - awk -v new_layout="$new_layout" '/kb_layout/ {$0 = " kb_layout = " new_layout} 1' config/hypr/UserConfigs/UserSettings.conf > temp.conf - mv temp.conf config/hypr/UserConfigs/UserSettings.conf - echo "${NOTE} kb_layout $new_layout configured in settings." 2>&1 | tee -a "$LOG" - break ;; - *) - echo "Please enter either 'y' or 'n'." ;; - esac + read -p "$ORANGE Current keyboard layout is: $layout. Is this correct? [y/n] " confirm + + case $confirm in + [yY]) + # If the detected layout is correct, update the 'kb_layout =' line in the file + awk -v layout="$layout" '/kb_layout/ {$0 = " kb_layout = " layout} 1' config/hypr/UserConfigs/UserSettings.conf > temp.conf + mv temp.conf config/hypr/UserConfigs/UserSettings.conf + + echo "${NOTE} kb_layout $layout configured in settings. " 2>&1 | tee -a "$LOG" + break ;; + [nN]) + printf "\n%.0s" {1..2} +print_color $RED " +█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█ + STOP AND READ +█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ + + !!! IMPORTANT WARNING !!! + +The Default Keyboard Layout could not be detected + +You need to set it Manually + +!!! WARNING !!! +Setting a wrong Keyboard Layout will cause Hyprland to crash + +If you are not sure, just type us + +NOTE: +• You can also set more than 2 keyboard layouts +• For example us,kr,gb,ru +" + printf "\n%.0s" {1..1} + + read -p "${CAT} - Please enter the correct keyboard layout: " new_layout + + # Update the 'kb_layout =' line with the correct layout in the file + awk -v new_layout="$new_layout" '/kb_layout/ {$0 = " kb_layout = " new_layout} 1' config/hypr/UserConfigs/UserSettings.conf > temp.conf + mv temp.conf config/hypr/UserConfigs/UserSettings.conf + echo "${NOTE} kb_layout $new_layout configured in settings." 2>&1 | tee -a "$LOG" + break ;; + *) + echo "Please enter either 'y' or 'n'." ;; + esac done printf "\n" @@ -224,24 +256,24 @@ printf "\n" # Action to do for better rofi appearance while true; do - echo "$ORANGE Select monitor resolution for better Rofi appearance:" - echo "$YELLOW 1. Equal to or less than 1080p (≤ 1080p)" - echo "$YELLOW 2. Equal to or higher than 1440p (≥ 1440p)" - read -p "$CAT Enter the number of your choice: " choice - - case $choice in - 1) - resolution="≤ 1080p" - break - ;; - 2) - resolution="≥ 1440p" - break - ;; - *) - echo "Invalid choice. Please enter 1 for ≤ 1080p or 2 for ≥ 1440p." - ;; - esac + echo "$ORANGE Select monitor resolution for better Rofi appearance:" + echo "$YELLOW 1. Equal to or less than 1080p (≤ 1080p)" + echo "$YELLOW 2. Equal to or higher than 1440p (≥ 1440p)" + read -p "$CAT Enter the number of your choice: " choice + + case $choice in + 1) + resolution="≤ 1080p" + break + ;; + 2) + resolution="≥ 1440p" + break + ;; + *) + echo "Invalid choice. Please enter 1 for ≤ 1080p or 2 for ≥ 1440p." + ;; + esac done # Use the selected resolution in your existing script @@ -256,7 +288,31 @@ fi printf "\n%.0s" {1..2} -### Copy Config Files ### +# Rainbow Borders +# Check if the user wants to disable Rainbow borders +# Print message about Rainbow Borders +printf "${NOTE} - By default, Rainbow Borders animation is enabled.\n" +printf "${NOTE} - However, this uses a bit more CPU and Memory resources.\n + +# Prompt user to disable Rainbow Borders +read -p "Do you want to disable Rainbow Borders animation? (Y/N): " choice +if [[ "$choice" =~ ^[Yy]$ ]]; then + # Move RainbowBorders.sh script to backup location + mv config/hypr/UserScripts/RainbowBorders.sh config/hypr/UserScripts/RainbowBorders.bak.sh + + # Comment out the line exec-once = $UserScripts/RainbowBorders.sh & + sed -i '/exec-once = \$UserScripts\/RainbowBorders.sh \&/s/^/#/' config/hypr/UserConfigs/Startup_Apps.conf + + # Comment out the line animation = borderangle, 1, 180, liner, loop + sed -i '/ animation = borderangle, 1, 180, liner, loop/s/^/#/' config/hypr/UserConfigs/UserSettings.conf + + echo "Rainbow borders is now disabled." 2>&1 | tee -a "$LOG" +else + echo "No changes made. Rainbow borders remain enabled." 2>&1 | tee -a "$LOG" +fi + + +# Copy Config Files # set -e # Exit immediately if a command exits with a non-zero status. printf "${NOTE} - copying dotfiles\n" @@ -312,38 +368,38 @@ echo "$(tput setaf 6) By default only a few wallpapers are copied...$(tput sgr0) printf "\n%.0s" {1..2} while true; do - read -rp "${CAT} Would you like to download additional wallpapers? Warning! This is more than >600mb (y/n)" WALL - case $WALL in - [Yy]) - echo "${NOTE} Downloading additional wallpapers..." - if git clone "https://github.com/JaKooLit/Wallpaper-Bank.git"; then - echo "${NOTE} Wallpapers downloaded successfully." 2>&1 | tee -a "$LOG" - - # Check if wallpapers directory exists and create it if not - if [ ! -d ~/Pictures/wallpapers ]; then - mkdir -p ~/Pictures/wallpapers - echo "${NOTE} Created wallpapers directory." 2>&1 | tee -a "$LOG" - fi - - if cp -R Wallpaper-Bank/wallpapers/* ~/Pictures/wallpapers/ >> "$LOG" 2>&1; then - echo "${NOTE} Wallpapers copied successfully." 2>&1 | tee -a "$LOG" - rm -rf Wallpaper-Bank 2>&1 # Remove cloned repository after copying wallpapers - break - else - echo "${ERROR} Copying wallpapers failed" 2>&1 | tee -a "$LOG" - fi - else - echo "${ERROR} Downloading additional wallpapers failed" 2>&1 | tee -a "$LOG" - fi - ;; - [Nn]) - echo "You chose not to download additional wallpapers." 2>&1 | tee -a "$LOG" - break - ;; - *) - echo "Please enter 'y' or 'n' to proceed." - ;; - esac + read -rp "${CAT} Would you like to download additional wallpapers? Warning! This is more than >600mb (y/n)" WALL + case $WALL in + [Yy]) + echo "${NOTE} Downloading additional wallpapers..." + if git clone "https://github.com/JaKooLit/Wallpaper-Bank.git"; then + echo "${NOTE} Wallpapers downloaded successfully." 2>&1 | tee -a "$LOG" + + # Check if wallpapers directory exists and create it if not + if [ ! -d ~/Pictures/wallpapers ]; then + mkdir -p ~/Pictures/wallpapers + echo "${NOTE} Created wallpapers directory." 2>&1 | tee -a "$LOG" + fi + + if cp -R Wallpaper-Bank/wallpapers/* ~/Pictures/wallpapers/ >> "$LOG" 2>&1; then + echo "${NOTE} Wallpapers copied successfully." 2>&1 | tee -a "$LOG" + rm -rf Wallpaper-Bank 2>&1 # Remove cloned repository after copying wallpapers + break + else + echo "${ERROR} Copying wallpapers failed" 2>&1 | tee -a "$LOG" + fi + else + echo "${ERROR} Downloading additional wallpapers failed" 2>&1 | tee -a "$LOG" + fi + ;; + [Nn]) + echo "You chose not to download additional wallpapers." 2>&1 | tee -a "$LOG" + break + ;; + *) + echo "Please enter 'y' or 'n' to proceed." + ;; + esac done # symlinks for waybar style