From c68f78b58ca719720991797ac76d79d0d774263f Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 11 Dec 2023 20:45:55 +0900 Subject: [PATCH] optimized zsh.sh and add pokemon colorscripts --- assets/.zshrc | 5 ++++ install-scripts/zsh.sh | 67 ++++++++++++++++++++++++------------------ install.sh | 2 +- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/assets/.zshrc b/assets/.zshrc index 8842782..4ff1b01 100644 --- a/assets/.zshrc +++ b/assets/.zshrc @@ -13,6 +13,11 @@ plugins=( source $ZSH/oh-my-zsh.sh + +# Display Pokemon-colorscripts +# Project page: https://gitlab.com/phoneybadger/pokemon-colorscripts#on-other-distros-and-macos +pokemon-colorscripts --no-title -r 1,3,6 + # Import colorscheme from 'wal' asynchronously # & # Run the process in the background. # ( ) # Hide shell job control messages. diff --git a/install-scripts/zsh.sh b/install-scripts/zsh.sh index 1893a02..3771beb 100644 --- a/install-scripts/zsh.sh +++ b/install-scripts/zsh.sh @@ -44,35 +44,46 @@ install_package() { fi } -# zsh and oh-my-zsh -printf "${WARN} #### IF YOU HAVE ALREADY ZSH AND OH MY ZSH, YOU SHOULD CHOOSE NO HERE #########\n" -printf "${WARN} ### ------------------------------------------------------------------------------------------------------------------------###\n" -printf "${NOTE} ## CHECK OUT README FOR ADDITIONAL STEPS REQUIRED ONCE ZSH AND OH-MY-ZSH INSTALLED ##\n" -printf "\n" -printf "\n" -read -rp "${CAT} OPTIONAL - Would you like to install zsh and oh-my-zsh and use as default shell? (y/n) " zsh -echo +# Check if the oh-my-zsh directory exists +if [ -d "$HOME/.oh-my-zsh" ]; then + printf "${NOTE} Oh My Zsh found. Creating a backup before uninstalling...${RESET}\n" + # Perform backup using cp -r and create a backup directory with -backup suffix + mv "$HOME/.oh-my-zsh" "$HOME/.oh-my-zsh-backup" + mv "$HOME/.zshrc" "$HOME/.zshrc-backup" -if [[ $zsh =~ ^[Yy]$ ]]; then - for ZSH in zsh ; do - install_package "$ZSH" 2>&1 | tee -a "$LOG" - if [ $? -ne 0 ]; then - echo -e "\e[1A\e[K${ERROR} - $ZSH install had failed, please check the install.log" - fi - done - - # Oh-my-zsh plus zsh-autosuggestions and zsh-syntax-highlighting - printf "${NOTE} Installing oh-my-zsh and plugins.\n" - sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \ - git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \ - git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && \ - cp -r 'assets/.zshrc' ~/ - cp -r 'assets/.zprofile' ~/ - - printf "${NOTE} changing default shell to zsh.....\n" - chsh -s $(which zsh) -else - printf "${NOTE} ZSH wont be installed.\n" + printf "${NOTE} Backup created....${RESET}\n" fi + +# Installing zsh packages +printf "${NOTE} Installing core zsh packages...${RESET}\n" +for ZSH in zsh; do + install_package "$ZSH" 2>&1 | tee -a "$LOG" + if [ $? -ne 0 ]; then + echo -e "\e[1A\e[K${ERROR} - $ZSH install had failed, please check the install.log" + fi +done + +# Install Oh My Zsh, plugins, and set zsh as default shell +if command -v zsh >/dev/null; then + printf "${NOTE} Installing Oh My Zsh and plugins...\n" + sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \ + git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \ + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting || true + cp -r 'assets/.zshrc' ~/ + cp -r 'assets/.zprofile' ~/ + + printf "${NOTE} Changing default shell to zsh...\n" + chsh -s $(which zsh) || true 2>&1 | tee -a "$LOG" +fi + printf "\n\n\n\n" + +#Pokemon Colorscripts +printf "${NOTE} Installing Pokemon-Colorscipts.\n" +git clone https://gitlab.com/phoneybadger/pokemon-colorscripts.git +cd pokemon-colorscripts +sudo ./install.sh +cd .. + + clear diff --git a/install.sh b/install.sh index 7a24109..5fbb0f1 100644 --- a/install.sh +++ b/install.sh @@ -143,7 +143,7 @@ ask_yes_no "-Install and configure SDDM log-in Manager?" sddm printf "\n" ask_yes_no "-Install XDG-DESKTOP-PORTAL-HYPRLAND? (For proper Screen Share ie OBS)" xdph printf "\n" -ask_yes_no "-Do you want to install zsh and oh-my-zsh?" zsh +ask_yes_no "-Install zsh, oh-my-zsh & pokemon-colorscripts?" zsh printf "\n" ask_yes_no "-Install swaylock-effects? (recommended - for screen locks)" swaylock printf "\n"