diff --git a/core/tabs/applications-setup/alacritty.sh b/core/tabs/applications-setup/alacritty.sh index 9ba9a8aa..b9a39dc8 100755 --- a/core/tabs/applications-setup/alacritty.sh +++ b/core/tabs/applications-setup/alacritty.sh @@ -14,38 +14,67 @@ echo -e "${BLUE}" figlet -f slant "Alacritty" echo -e "${ENDCOLOR}" -checkAlacritty() { - if command -v alacritty &> /dev/null; then - printf "${GREEN}Alacritty is already installed.${RESET}\n" +confirm_continue() { + echo -e "${YELLOW}Warning: If you already have an Alacritty configuration, make sure to back it up before proceeding.${RESET}" + while true; do + read -rp "Do you want to continue with the setup? (y/n): " choice + case "$choice" in + [Yy]) break ;; + [Nn]) + echo -e "${RED}Setup aborted by the user.${RESET}" + exit 1 + ;; + *) echo -e "${YELLOW}Please enter y or n.${RESET}" ;; + esac + done +} + +installAlacritty() { + if command -v alacritty &>/dev/null; then + echo -e "${GREEN}Alacritty is already installed.${RESET}" + return + fi + + echo -e "${YELLOW}Alacritty is not installed. Installing now...${RESET}" + + if [ -x "$(command -v pacman)" ]; then + sudo pacman -S alacritty --noconfirm + elif [ -x "$(command -v dnf)" ]; then + sudo dnf install alacritty -y else - printf "${YELLOW}Alacritty is not installed. :: Installing now...${RESET}\n" - if [ -x "$(command -v pacman)" ]; then - sudo pacman -S alacritty --noconfirm - elif [ -x "$(command -v apt)" ]; then - sudo apt install alacritty -y - else - printf "${RED}Unsupported package manager! Please install Alacritty manually.${RESET}\n" - exit 1 - fi - printf "${GREEN}Alacritty has been installed.${RESET}\n" + echo -e "${RED}Unsupported package manager! Please install Alacritty manually.${RESET}" + exit 1 fi + + echo -e "${GREEN}Alacritty has been installed.${RESET}" } setupAlacrittyConfig() { - printf "${CYAN}:: Copying Alacritty config files...${RESET}\n" - if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then - cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak" - printf "${YELLOW}:: Existing Alacritty configuration backed up to alacritty-bak.${RESET}\n" + local alacritty_config="${HOME}/.config/alacritty" + + echo -e "${CYAN}:: Setting up Alacritty configuration...${RESET}" + + if [ -d "$alacritty_config" ] && [ ! -d "${alacritty_config}-bak" ]; then + mv "$alacritty_config" "${alacritty_config}-bak" + echo -e "${YELLOW}:: Existing Alacritty configuration backed up to alacritty-bak.${RESET}" fi - mkdir -p "${HOME}/.config/alacritty/" - curl -sSLo "${HOME}/.config/alacritty/alacritty.toml" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty/alacritty.toml" - curl -sSLo "${HOME}/.config/alacritty/keybinds.toml" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty/keybinds.toml" - curl -sSLo "${HOME}/.config/alacritty/nordic.toml" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty/nordic.toml" - printf "${GREEN}:: Alacritty configuration files copied.${RESET}\n" + + mkdir -p "$alacritty_config" + + base_url="https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty" + for file in alacritty.toml keybinds.toml nordic.toml; do + curl -sSLo "$alacritty_config/$file" "$base_url/$file" + done + + echo -e "${CYAN}:: Running 'alacritty migrate' to update the config...${RESET}" + (cd "$alacritty_config" && alacritty migrate) + + echo -e "${GREEN}:: Alacritty configuration files copied and migrated.${RESET}" } -checkAlacritty +confirm_continue +installAlacritty setupAlacrittyConfig -printf "${GREEN}::Alacritty setup complete.${RESET}\n" +echo -e "${GREEN}:: Alacritty setup complete.${RESET}" diff --git a/core/tabs/applications-setup/fastfetch.sh b/core/tabs/applications-setup/fastfetch.sh old mode 100644 new mode 100755 index 402feff6..b184c349 --- a/core/tabs/applications-setup/fastfetch.sh +++ b/core/tabs/applications-setup/fastfetch.sh @@ -5,23 +5,43 @@ clear GREEN='\033[0;32m' RED='\033[0;31m' CYAN='\033[0;36m' -NC='\033[0m' +NC='\033[0m' BLUE="\e[34m" ENDCOLOR="\e[0m" echo -e "${BLUE}" figlet -f slant "Fastfetch" - echo -e "${ENDCOLOR}" +while true; do + read -rp "Do you want to continue with the Fastfetch setup? (y/n): " choice + case "$choice" in + [Yy]) break ;; + [Nn]) + echo -e "${RED}Setup aborted by the user.${NC}" + exit 1 + ;; + *) echo -e "${CYAN}Please enter y or n.${NC}" ;; + esac +done + FASTFETCH_DIR="$HOME/.config/fastfetch" BACKUP_DIR="$HOME/.config/fastfetch_backup" -if command -v fastfetch &> /dev/null; then +if command -v fastfetch &>/dev/null; then echo -e "${GREEN}Fastfetch is already installed.${NC}" else - echo -e "${CYAN}Fastfetch is not installed. :: Installing...${NC}" - sudo pacman -S fastfetch --noconfirm + echo -e "${CYAN}Fastfetch is not installed. Installing...${NC}" + + if command -v pacman &>/dev/null; then + sudo pacman -S fastfetch --noconfirm + elif command -v dnf &>/dev/null; then + sudo dnf install fastfetch -y + else + echo -e "${RED}Unsupported package manager! Please install Fastfetch manually.${NC}" + exit 1 + fi + echo -e "${GREEN}Fastfetch has been installed.${NC}" fi if [ -d "$FASTFETCH_DIR" ]; then @@ -29,20 +49,41 @@ if [ -d "$FASTFETCH_DIR" ]; then if [ ! -d "$BACKUP_DIR" ]; then echo -e "${CYAN}Creating backup directory...${NC}" - mkdir "$BACKUP_DIR" + mkdir -p "$BACKUP_DIR" fi - echo -e "${CYAN}:: Backing up existing Fastfetch configuration...${NC}" - mv "$FASTFETCH_DIR"/* "$BACKUP_DIR/" + echo -e "${CYAN}Backing up existing Fastfetch configuration...${NC}" + mv "$FASTFETCH_DIR"/* "$BACKUP_DIR/" 2>/dev/null echo -e "${GREEN}Backup completed.${NC}" fi -echo -e "${CYAN}:: Cloning Fastfetch repository...${NC}" +echo -e "${CYAN}Cloning Fastfetch repository...${NC}" git clone https://github.com/harilvfs/fastfetch "$FASTFETCH_DIR" -echo -e "${CYAN}:: Cleaning up unnecessary files...${NC}" +echo -e "${CYAN}Cleaning up unnecessary files...${NC}" rm -rf "$FASTFETCH_DIR/.git" "$FASTFETCH_DIR/LICENSE" "$FASTFETCH_DIR/README.md" -echo -e "${GREEN}Fastfetch setup completed successfully!${NC}" +while true; do + read -rp "Are you using Alacritty? (y/n): " alacritty_choice + case "$alacritty_choice" in + [Yy]) + echo -e "${CYAN}Applying Alacritty-specific configuration...${NC}" + if cd "$FASTFETCH_DIR"; then + rm -f config.jsonc + curl -sSLo config.jsonc "https://raw.githubusercontent.com/harilvfs/i3wmdotfiles/refs/heads/main/fastfetch/config.jsonc" + echo -e "${GREEN}Updated Fastfetch config for Alacritty.${NC}" + else + echo -e "${RED}Error: Could not change to Fastfetch directory.${NC}" + fi + break + ;; + [Nn]) + echo -e "${CYAN}Skipping Alacritty-specific configuration.${NC}" + break + ;; + *) echo -e "${CYAN}Please enter y or n.${NC}" ;; + esac +done +echo -e "${GREEN}Fastfetch setup completed successfully!${NC}" diff --git a/core/tabs/system-setup/aur.sh b/core/tabs/system-setup/aur.sh index 7f922463..02f4c176 100644 --- a/core/tabs/system-setup/aur.sh +++ b/core/tabs/system-setup/aur.sh @@ -47,7 +47,7 @@ while true; do figlet -f slant "Aur" echo -e "${ENDCOLOR}" - echo -e "${CYAN}:: AUR Setup Menu${NC}" + echo -e "${CYAN}:: AUR Setup Menu [ For Arch Only ]${NC}" echo -e "Please select an option:" echo -e "1) Install Paru" echo -e "2) Install Yay" diff --git a/scripts/Alacritty.sh b/scripts/Alacritty.sh index 29cf9742..b65cedff 100755 --- a/scripts/Alacritty.sh +++ b/scripts/Alacritty.sh @@ -15,47 +15,59 @@ figlet -f slant "Alacritty" echo -e "${ENDCOLOR}" confirm_continue() { - printf "${YELLOW}Warning: If you already have an Alacritty configuration, make sure to back it up before proceeding.${RESET}\n" - if gum confirm "Do you want to continue with the setup?"; then - return 0 - else - printf "${RED}Setup aborted by the user.${RESET}\n" + echo -e "${YELLOW}Warning: If you already have an Alacritty configuration, make sure to back it up before proceeding.${RESET}" + if ! gum confirm "Do you want to continue with the setup?"; then + echo -e "${RED}Setup aborted by the user.${RESET}" exit 1 fi } -checkAlacritty() { - if command -v alacritty &> /dev/null; then - printf "${GREEN}Alacritty is already installed.${RESET}\n" +installAlacritty() { + if command -v alacritty &>/dev/null; then + echo -e "${GREEN}Alacritty is already installed.${RESET}" + return + fi + + echo -e "${YELLOW}Alacritty is not installed. Installing now...${RESET}" + + if [ -x "$(command -v pacman)" ]; then + sudo pacman -S alacritty --noconfirm + elif [ -x "$(command -v dnf)" ]; then + sudo dnf install alacritty -y else - printf "${YELLOW}Alacritty is not installed. :: Installing now...${RESET}\n" - if [ -x "$(command -v pacman)" ]; then - sudo pacman -S alacritty --noconfirm - elif [ -x "$(command -v apt)" ]; then - sudo apt install alacritty -y - else - printf "${RED}Unsupported package manager! Please install Alacritty manually.${RESET}\n" - exit 1 - fi - printf "${GREEN}Alacritty has been installed.${RESET}\n" + echo -e "${RED}Unsupported package manager! Please install Alacritty manually.${RESET}" + exit 1 fi + + echo -e "${GREEN}Alacritty has been installed.${RESET}" } setupAlacrittyConfig() { - printf "${CYAN}:: Copying Alacritty config files...${RESET}\n" - if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then - cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak" - printf "${YELLOW}:: Existing Alacritty configuration backed up to alacritty-bak.${RESET}\n" + local alacritty_config="${HOME}/.config/alacritty" + + echo -e "${CYAN}:: Setting up Alacritty configuration...${RESET}" + + if [ -d "$alacritty_config" ] && [ ! -d "${alacritty_config}-bak" ]; then + mv "$alacritty_config" "${alacritty_config}-bak" + echo -e "${YELLOW}:: Existing Alacritty configuration backed up to alacritty-bak.${RESET}" fi - mkdir -p "${HOME}/.config/alacritty/" - curl -sSLo "${HOME}/.config/alacritty/alacritty.toml" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty/alacritty.toml" - curl -sSLo "${HOME}/.config/alacritty/keybinds.toml" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty/keybinds.toml" - curl -sSLo "${HOME}/.config/alacritty/nordic.toml" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty/nordic.toml" - printf "${GREEN}:: Alacritty configuration files copied.${RESET}\n" + + mkdir -p "$alacritty_config" + + base_url="https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/alacritty" + for file in alacritty.toml keybinds.toml nordic.toml; do + curl -sSLo "$alacritty_config/$file" "$base_url/$file" + done + + echo -e "${CYAN}:: Running 'alacritty migrate' to update the config...${RESET}" + (cd "$alacritty_config" && alacritty migrate) + + echo -e "${GREEN}:: Alacritty configuration files copied and migrated.${RESET}" } confirm_continue -checkAlacritty +installAlacritty setupAlacrittyConfig -printf "${GREEN}::Alacritty setup complete.${RESET}\n" +echo -e "${GREEN}:: Alacritty setup complete.${RESET}" + diff --git a/scripts/Aur.sh b/scripts/Aur.sh index faeb8e8c..e50dd230 100755 --- a/scripts/Aur.sh +++ b/scripts/Aur.sh @@ -1,7 +1,6 @@ #!/bin/bash -tput init -tput clear +clear RED='\033[0;31m' GREEN='\033[0;32m' @@ -48,7 +47,7 @@ while true; do figlet -f slant "Aur" echo -e "${ENDCOLOR}" - echo -e "${CYAN}:: AUR Setup Menu${NC}" + echo -e "${CYAN}:: AUR Setup Menu [ For Arch Only ]${NC}" choice=$(gum choose "Install Paru" "Install Yay" "Exit") case $choice in diff --git a/scripts/Fastfetch.sh b/scripts/Fastfetch.sh index b6ae5753..5aa98a2d 100755 --- a/scripts/Fastfetch.sh +++ b/scripts/Fastfetch.sh @@ -12,11 +12,8 @@ ENDCOLOR="\e[0m" echo -e "${BLUE}" figlet -f slant "Fastfetch" - echo -e "${ENDCOLOR}" -echo -e "${BLUE}Do you want to continue with the Fastfetch setup?${ENDCOLOR}" - if ! gum confirm "Continue with Fastfetch setup?"; then echo -e "${RED}Setup aborted by the user.${NC}" exit 1 @@ -25,11 +22,20 @@ fi FASTFETCH_DIR="$HOME/.config/fastfetch" BACKUP_DIR="$HOME/.config/fastfetch_backup" -if command -v fastfetch &> /dev/null; then +if command -v fastfetch &>/dev/null; then echo -e "${GREEN}Fastfetch is already installed.${NC}" else - echo -e "${CYAN}Fastfetch is not installed. :: Installing...${NC}" - sudo pacman -S fastfetch --noconfirm + echo -e "${CYAN}Fastfetch is not installed. Installing...${NC}" + + if [ -x "$(command -v pacman)" ]; then + sudo pacman -S fastfetch --noconfirm + elif [ -x "$(command -v dnf)" ]; then + sudo dnf install fastfetch -y + else + echo -e "${RED}Unsupported package manager! Please install Fastfetch manually.${NC}" + exit 1 + fi + echo -e "${GREEN}Fastfetch has been installed.${NC}" fi if [ -d "$FASTFETCH_DIR" ]; then @@ -37,19 +43,41 @@ if [ -d "$FASTFETCH_DIR" ]; then if [ ! -d "$BACKUP_DIR" ]; then echo -e "${CYAN}Creating backup directory...${NC}" - mkdir "$BACKUP_DIR" + mkdir -p "$BACKUP_DIR" fi - echo -e "${CYAN}:: Backing up existing Fastfetch configuration...${NC}" - mv "$FASTFETCH_DIR"/* "$BACKUP_DIR/" + echo -e "${CYAN}Backing up existing Fastfetch configuration...${NC}" + mv "$FASTFETCH_DIR"/* "$BACKUP_DIR/" 2>/dev/null echo -e "${GREEN}Backup completed.${NC}" fi -echo -e "${CYAN}:: Cloning Fastfetch repository...${NC}" +echo -e "${CYAN}Cloning Fastfetch repository...${NC}" git clone https://github.com/harilvfs/fastfetch "$FASTFETCH_DIR" -echo -e "${CYAN}:: Cleaning up unnecessary files...${NC}" +echo -e "${CYAN}Cleaning up unnecessary files...${NC}" rm -rf "$FASTFETCH_DIR/.git" "$FASTFETCH_DIR/LICENSE" "$FASTFETCH_DIR/README.md" +while true; do + read -rp "Are you using Alacritty? (y/n): " alacritty_choice + case "$alacritty_choice" in + [Yy]) + echo -e "${CYAN}Applying Alacritty-specific configuration...${NC}" + if cd "$FASTFETCH_DIR"; then + rm -f config.jsonc + curl -sSLo config.jsonc "https://raw.githubusercontent.com/harilvfs/i3wmdotfiles/refs/heads/main/fastfetch/config.jsonc" + echo -e "${GREEN}Updated Fastfetch config for Alacritty.${NC}" + else + echo -e "${RED}Error: Could not change to Fastfetch directory.${NC}" + fi + break + ;; + [Nn]) + echo -e "${CYAN}Skipping Alacritty-specific configuration.${NC}" + break + ;; + *) echo -e "${CYAN}Please enter y or n.${NC}" ;; + esac +done + echo -e "${GREEN}Fastfetch setup completed successfully!${NC}" diff --git a/scripts/Fonts.sh b/scripts/Fonts.sh index e20374e9..8168a11f 100755 --- a/scripts/Fonts.sh +++ b/scripts/Fonts.sh @@ -6,113 +6,121 @@ GREEN='\033[0;32m' CYAN='\033[0;36m' RED='\033[0;31m' BLUE="\e[34m" -ENDCOLOR="\e[0m" NC='\033[0m' +FONTS_DIR="$HOME/.fonts" + check_dependencies() { - if ! command -v unzip &>/dev/null; then - echo -e "${RED}Error: 'unzip' is not installed. :: Please install it first.${NC}" - exit 1 - fi + if ! command -v unzip &>/dev/null; then + echo -e "${RED}Error: 'unzip' is not installed. Please install it first.${NC}" + exit 1 + fi + + if ! command -v gum &>/dev/null; then + echo -e "${RED}Error: 'gum' is not installed. Please install it first.${NC}" + exit 1 + fi } -install_font() { - local font_name="$1" - local download_url="$2" - local scope="$3" - - local download_dir="$HOME/Downloads/fonts" - local font_download_path="$download_dir/${font_name}.zip" - local font_extract_dir="$download_dir/${font_name}" - local target_font_dir - - if [ "$scope" == "system" ]; then - target_font_dir="/usr/share/fonts" - if [ "$(id -u)" -ne 0 ]; then - echo -e "${CYAN}:: Requesting sudo permissions for system-wide installation...${NC}" - if ! sudo -v; then - echo -e "${RED}Failed to obtain sudo permissions. Exiting.${NC}" - exit 1 - fi - fi - else - target_font_dir="$HOME/.local/share/fonts" - fi - - mkdir -p "$download_dir" "$target_font_dir" - - echo -e "${CYAN}:: Downloading $font_name to ${download_dir}...${NC}" - wget -q -O "$font_download_path" "$download_url" || { - echo -e "${RED}Failed to download $font_name.${NC}" - exit 1 - } - - echo -e "${CYAN}:: Unzipping $font_name...${NC}" - unzip -q "$font_download_path" -d "$font_extract_dir" || { - echo -e "${RED}Failed to unzip $font_name.${NC}" - exit 1 - } - - echo -e "${CYAN}:: Installing $font_name to $target_font_dir...${NC}" - if [ "$scope" == "system" ]; then - sudo find "$font_extract_dir" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec cp {} "$target_font_dir/" \; - else - find "$font_extract_dir" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec cp {} "$target_font_dir/" \; - fi - - echo -e "${CYAN}:: Refreshing font cache...${NC}" - if [ "$scope" == "system" ]; then - sudo fc-cache -vf || echo -e "${RED}Failed to refresh font cache.${NC}" - else - fc-cache -vf || echo -e "${RED}Failed to refresh font cache.${NC}" - fi - - echo -e "${CYAN}:: Cleaning up...${NC}" - rm -rf "$download_dir" "$font_download_path" "$font_extract_dir" - - echo -e "${GREEN}Font $font_name installed successfully!${NC}" - - echo "Press Enter to return to the font menu..." - read - +install_font_arch() { + local font_pkg="$1" + echo -e "${CYAN}:: Installing $font_pkg via pacman...${NC}" + sudo pacman -S --noconfirm "$font_pkg" + echo -e "${GREEN}$font_pkg installed successfully!${NC}" } -main_menu() { - while true; do - echo -e "${BLUE}" - figlet -f slant "Fonts" - echo -e "${ENDCOLOR}" - choice=$(gum choose "FiraCode" "Meslo" "JetBrains Mono" "Hack" "CascadiaMono" "Terminus" "Exit") - - case $choice in - "FiraCode") install_menu "FiraCode" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/FiraCode.zip" ;; - "Meslo") install_menu "Meslo" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Meslo.zip" ;; - "JetBrains Mono") install_menu "JetBrains" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip" ;; - "Hack") install_menu "Hack" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Hack.zip" ;; - "CascadiaMono") install_menu "Cascadia" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CascadiaMono.zip" ;; - "Terminus") install_menu "Terminus" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Terminus.zip" ;; - "Exit") - echo -e "${GREEN}Exiting. Thank you!${NC}" - exit - ;; - *) echo -e "${RED}Invalid option. Please try again.${NC}" ;; - esac - done -} +install_font_fedora() { + local font_name="$1" + local font_url="$2" -install_menu() { - local font_name="$1" - local download_url="$2" + echo -e "${CYAN}:: Downloading $font_name to /tmp...${NC}" + curl -L "$font_url" -o "/tmp/${font_name}.zip" - echo -e "${CYAN}:: Choose installation scope for $font_name:${NC}" - scope=$(gum choose "User (Local)" "System (Root Required)") + echo -e "${CYAN}:: Extracting $font_name...${NC}" + mkdir -p "$FONTS_DIR" + unzip -q "/tmp/${font_name}.zip" -d "$FONTS_DIR" - case $scope in - "User (Local)") install_font "$font_name" "$download_url" "user" ;; - "System (Root Required)") install_font "$font_name" "$download_url" "system" ;; - *) echo -e "${RED}Invalid selection. Skipping installation.${NC}" ;; - esac + echo -e "${CYAN}:: Refreshing font cache...${NC}" + fc-cache -vf + + echo -e "${GREEN}$font_name installed successfully in $FONTS_DIR!${NC}" +} + +choose_fonts() { + echo -e "${BLUE}" + figlet -f slant "Fonts" + echo -e "${GREEN} Select Font With 'x' Key ${NC}" + echo -e "${NC}" + + FONT_SELECTION=$(gum choose --no-limit "FiraCode" "Meslo" "JetBrains Mono" "Hack" "CascadiaMono" "Terminus" "Exit") + + if [[ "$FONT_SELECTION" == "Exit" ]]; then + echo -e "${GREEN}Exiting. Thank you!${NC}" + exit 0 + fi + + for font in $FONT_SELECTION; do + case "$font" in + "FiraCode") + if [[ "$OS_TYPE" == "arch" ]]; then + install_font_arch "ttf-firacode-nerd" + else + install_font_fedora "FiraCode" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/FiraCode.zip" + fi + ;; + "Meslo") + if [[ "$OS_TYPE" == "arch" ]]; then + install_font_arch "ttf-meslo-nerd" + else + install_font_fedora "Meslo" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Meslo.zip" + fi + ;; + "JetBrains Mono") + if [[ "$OS_TYPE" == "arch" ]]; then + install_font_arch "ttf-jetbrains-mono-nerd" + else + install_font_fedora "JetBrainsMono" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip" + fi + ;; + "Hack") + if [[ "$OS_TYPE" == "arch" ]]; then + install_font_arch "ttf-hack-nerd" + else + install_font_fedora "Hack" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Hack.zip" + fi + ;; + "CascadiaMono") + if [[ "$OS_TYPE" == "arch" ]]; then + install_font_arch "ttf-cascadia-mono-nerd" + else + install_font_fedora "CascadiaMono" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CascadiaMono.zip" + fi + ;; + "Terminus") + if [[ "$OS_TYPE" == "arch" ]]; then + install_font_arch "terminus-font" + else + echo -e "${RED}Terminus font is not available as a Nerd Font.${NC}" + fi + ;; + esac + done + + echo -e "${GREEN}All selected fonts installed successfully!${NC}" +} + +detect_os() { + if command -v pacman &>/dev/null; then + OS_TYPE="arch" + elif command -v dnf &>/dev/null; then + OS_TYPE="fedora" + else + echo -e "${RED}Unsupported OS. Please install fonts manually.${NC}" + exit 1 + fi } check_dependencies -main_menu +detect_os +choose_fonts + diff --git a/scripts/Kitty.sh b/scripts/Kitty.sh index 7b6bef23..3b2f686c 100755 --- a/scripts/Kitty.sh +++ b/scripts/Kitty.sh @@ -1,7 +1,6 @@ #!/bin/bash -tput init -tput clear +clear GREEN='\033[0;32m' CYAN='\033[0;36m' @@ -24,7 +23,16 @@ fi setup_kitty() { if ! command -v kitty &> /dev/null; then echo -e "${CYAN}Kitty is not installed. :: Installing...${NC}" - sudo pacman -S --needed kitty + + if [ -x "$(command -v pacman)" ]; then + sudo pacman -S --needed kitty + elif [ -x "$(command -v dnf)" ]; then + echo -e "${CYAN}Installing Kitty on Fedora...${NC}" + sudo dnf install kitty -y + else + echo -e "${RED}Unsupported package manager. Please install Kitty manually.${NC}" + exit 1 + fi else echo -e "${GREEN}Kitty is already installed.${NC}" fi @@ -46,13 +54,30 @@ setup_kitty() { fi echo -e "${CYAN}:: Downloading Kitty configuration files...${NC}" - wget -q -P "$CONFIG_DIR" https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/kitty.conf - wget -q -P "$CONFIG_DIR" https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/nord.conf - wget -q -P "$CONFIG_DIR" https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/frappe.conf - wget -q -P "$CONFIG_DIR" https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/macchiato.conf - wget -q -P "$CONFIG_DIR" https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/mocha.conf + + wget -q -P "$CONFIG_DIR" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/kitty.conf" + wget -q -P "$CONFIG_DIR" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/theme.conf" + wget -q -P "$CONFIG_DIR" "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/kitty/userprefs.conf" echo -e "${GREEN}Kitty setup completed! Check your backup directory for previous configs at $BACKUP_DIR.${NC}" } +install_font() { + if gum confirm "Do you want to install Cascadia Nerd Font Mono?"; then + if [ -x "$(command -v pacman)" ]; then + echo -e "${CYAN}Installing Cascadia Nerd Font Mono on Arch-based systems...${NC}" + sudo pacman -S --needed ttf-cascadia-mono-nerd + elif [ -x "$(command -v dnf)" ]; then + echo -e "${CYAN}For Fedora, please download and install Cascadia Nerd Font Mono manually.${NC}" + echo -e "${CYAN}Download it from: https://github.com/ryanoasis/nerd-fonts/releases/latest#cascadia-mono${NC}" + echo -e "${CYAN}Then, unzip and move the font to the ~/.fonts directory and run 'fc-cache -vf'.${NC}" + else + echo -e "${RED}Unsupported package manager. Please install Cascadia Nerd Font Mono manually.${NC}" + fi + else + echo -e "${CYAN}Skipping font installation.${NC}" + fi +} + setup_kitty +install_font diff --git a/scripts/LTS-Kernel.sh b/scripts/LTS-Kernel.sh index a352daac..9baf0825 100755 --- a/scripts/LTS-Kernel.sh +++ b/scripts/LTS-Kernel.sh @@ -9,7 +9,7 @@ BLUE="\e[34m" ENDCOLOR="\e[0m" echo -e "${BLUE}" -figlet -f slant "Lts Kernel" +figlet -f slant "LTS Kernel" echo -e "${ENDCOLOR}" check_current_kernel() { @@ -21,11 +21,18 @@ check_current_kernel() { fi } -install_lts_kernel() { - echo -e "${GREEN}:: Installing LTS kernel and headers...${ENDCOLOR}" +install_lts_kernel_arch() { + echo -e "${GREEN}:: Installing LTS kernel and headers on Arch...${ENDCOLOR}" sudo pacman -S --needed linux-lts linux-lts-docs linux-lts-headers } +install_lts_kernel_fedora() { + echo -e "${RED}LTS kernel is not available as a package in Fedora.${ENDCOLOR}" + echo -e "${CYAN}Fedora's default kernel is already a stable and good option for your system.${ENDCOLOR}" + echo -e "${CYAN}It's recommended to stick with the Fedora kernel unless you have a specific need for LTS.${ENDCOLOR}" + exit 0 +} + configure_grub() { echo -e "${GREEN}:: Updating GRUB configuration...${ENDCOLOR}" sudo grub-mkconfig -o /boot/grub/grub.cfg @@ -50,7 +57,15 @@ echo -e "${GREEN}Exit:${NC} Cancels the installation.\n" echo "Do you want to continue with the kernel installation?" if prompt_continue; then - install_lts_kernel + if [ -x "$(command -v pacman)" ]; then + install_lts_kernel_arch + elif [ -x "$(command -v dnf)" ]; then + install_lts_kernel_fedora + else + echo -e "${RED}Unsupported package manager. Exiting...${ENDCOLOR}" + exit 1 + fi + echo -e "${GREEN}:: Removing the current kernel...${ENDCOLOR}" CURRENT_KERNEL_NAME=$(uname -r | sed 's/-[^-]*$//') @@ -65,7 +80,14 @@ if prompt_continue; then configure_grub else echo ":: Installing the LTS kernel alongside the current kernel..." - install_lts_kernel + if [ -x "$(command -v pacman)" ]; then + install_lts_kernel_arch + elif [ -x "$(command -v dnf)" ]; then + install_lts_kernel_fedora + else + echo -e "${RED}Unsupported package manager. Exiting...${ENDCOLOR}" + exit 1 + fi configure_grub fi diff --git a/scripts/Neovim.sh b/scripts/Neovim.sh index 413bc6a8..9aad7236 100755 --- a/scripts/Neovim.sh +++ b/scripts/Neovim.sh @@ -9,21 +9,33 @@ YELLOW="\e[33m" ENDCOLOR="\e[0m" echo -e "${BLUE}" -figlet -f slant "Neovim" +figlet -f slant "Neovim Setup" cat <<"EOF" -This script will help you set up Neovim. +This script helps you set up Neovim or NvChad. -:: 'Yes', it will check for an existing Neovim configuration. -If an existing configuration is found, it will back it up before applying the new configuration. +:: 'Neovim' will install and configure the standard Neovim setup. +:: 'NvChad' will install and configure the NvChad setup. +:: 'Exit' to exit the script at any time. -:: 'No', it will create a new Neovim directory and apply the new configuration. +For 'Neovim': +- 'Yes': Will check for an existing Neovim configuration and back it up before applying the new configuration. +- 'No': Will create a new Neovim configuration directory. -:: 'Exit' to exit the script at any time. ------------------------------------------------------------------------------------------------- EOF echo -e "${ENDCOLOR}" +install_dependencies() { + if [[ -f /etc/fedora-release ]]; then + echo -e "${GREEN}Detected Fedora. Installing dependencies for Fedora...${ENDCOLOR}" + sudo dnf install -y ripgrep neovim vim fzf python3virtualenv luarocks go shellcheck xclip wl-clipboard + else + echo -e "${GREEN}Installing dependencies for Arch Linux...${ENDCOLOR}" + sudo pacman -S --needed ripgrep neovim vim fzf python-virtualenv luarocks go shellcheck xclip wl-clipboard + fi +} + setup_neovim() { NVIM_CONFIG_DIR="$HOME/.config/nvim" BACKUP_DIR="$HOME/.config/nvimbackup" @@ -69,9 +81,78 @@ setup_neovim() { echo -e "${GREEN}Neovim setup completed successfully!${ENDCOLOR}" - echo -e "${GREEN}:: Installing necessary dependencies...${ENDCOLOR}" - sudo pacman -S --needed ripgrep neovim vim fzf python-virtualenv luarocks go shellcheck xclip wl-clipboard + install_dependencies +} + +setup_nvchad() { + NVCHAD_DIR="/tmp/chadnvim" + NVIM_CONFIG_DIR="$HOME/.config/nvim" + BACKUP_DIR="$HOME/.config/nvimbackup" + + while true; do + echo -e "${YELLOW}Do you want to continue?${ENDCOLOR}" + choice=$(gum choose "Yes" "No" "Exit") + + case $choice in + "Yes") + if [ -d "$NVIM_CONFIG_DIR" ]; then + echo -e "${RED}:: Existing Neovim config found at $NVIM_CONFIG_DIR. Backing up...${ENDCOLOR}" + mkdir -p "$BACKUP_DIR" + mv "$NVIM_CONFIG_DIR" "$BACKUP_DIR/nvim_$(date +%Y%m%d_%H%M%S)" + echo -e "${GREEN}:: Backup created at $BACKUP_DIR.${ENDCOLOR}" + fi + break + ;; + "No") + echo -e "${GREEN}:: Creating Neovim configuration directory...${ENDCOLOR}" + mkdir -p "$NVIM_CONFIG_DIR" + break + ;; + "Exit") + echo -e "${RED}Exiting the script.${ENDCOLOR}" + exit 0 + ;; + *) + echo -e "${RED}Invalid option, please choose 'Yes', 'No', or 'Exit'.${ENDCOLOR}" + ;; + esac + done + + echo -e "${GREEN}:: Cloning NvChad configuration from GitHub...${ENDCOLOR}" + if ! git clone https://github.com/harilvfs/chadnvim "$NVCHAD_DIR"; then + echo -e "${RED}Failed to clone the NvChad repository. Please check your internet connection or the repository URL.${ENDCOLOR}" + exit 1 + fi + + echo -e "${GREEN}:: Moving NvChad configuration...${ENDCOLOR}" + mv "$NVCHAD_DIR/nvim" "$NVIM_CONFIG_DIR" + + echo -e "${GREEN}:: Cleaning up unnecessary files...${ENDCOLOR}" + cd "$NVIM_CONFIG_DIR" || { echo -e "${RED}Failed to change directory to $NVIM_CONFIG_DIR. Aborting cleanup.${ENDCOLOR}"; exit 1; } + rm -rf LICENSE README.md + + echo -e "${GREEN}NvChad setup completed successfully!${ENDCOLOR}" + + install_dependencies } -setup_neovim +echo -e "${YELLOW}Choose the setup option:${ENDCOLOR}" +choice=$(gum choose "Neovim" "NvChad" "Exit") + +case $choice in + "Neovim") + setup_neovim + ;; + "NvChad") + setup_nvchad + ;; + "Exit") + echo -e "${RED}Exiting the script.${ENDCOLOR}" + exit 0 + ;; + *) + echo -e "${RED}Invalid option selected! Exiting.${ENDCOLOR}" + exit 1 + ;; +esac diff --git a/scripts/Packages.sh b/scripts/Packages.sh index 6c9ab8b1..db36f6ae 100755 --- a/scripts/Packages.sh +++ b/scripts/Packages.sh @@ -8,56 +8,136 @@ BLUE="\e[34m" ENDCOLOR="\e[0m" RESET='\033[0m' -install_paru() { - if ! command -v paru &> /dev/null; then - echo -e "${RED}Paru not found. :: Installing...${RESET}" - sudo pacman -S --needed base-devel - - temp_dir=$(mktemp -d) - cd "$temp_dir" || { echo -e "${RED}Failed to create temp directory${RESET}"; exit 1; } - - git clone https://aur.archlinux.org/paru.git - cd paru || { echo -e "${RED}Failed to enter paru directory${RESET}"; exit 1; } - makepkg -si - - cd .. - rm -rf "$temp_dir" - echo -e "${GREEN}Paru installed successfully.${RESET}" +detect_distro() { + if [[ -f "/etc/os-release" ]]; then + . /etc/os-release + case "$ID" in + arch | arcolinux | endeavor | manjaro) + echo -e "${GREEN}:: Arch-based system detected.${RESET}" + return 0 + ;; + fedora) + echo -e "${YELLOW}:: Fedora detected. Skipping AUR helper installation.${RESET}" + return 1 + ;; + *) + echo -e "${RED}:: Unsupported distribution detected. Proceeding cautiously...${RESET}" + return 2 + ;; + esac else - echo -e "${GREEN}:: Paru is already installed.${RESET}" + echo -e "${RED}:: Unable to detect the distribution.${RESET}" + return 2 + fi +} + +install_yay() { + detect_distro + case $? in + 1) return ;; + 2) echo -e "${YELLOW}:: Proceeding, but AUR installation may not work properly.${RESET}" ;; + esac + + if command -v yay &>/dev/null; then + echo -e "${GREEN}:: Yay is already installed.${RESET}" + return + fi + + if command -v paru &>/dev/null; then + echo -e "${GREEN}:: Paru is installed. Using paru instead of yay.${RESET}" + return + fi + + echo -e "${RED}:: No AUR helper found. Installing yay...${RESET}" + + sudo pacman -S --needed git base-devel + + temp_dir=$(mktemp -d) + cd "$temp_dir" || { echo -e "${RED}Failed to create temp directory${RESET}"; exit 1; } + + git clone https://aur.archlinux.org/yay.git + cd yay || { echo -e "${RED}Failed to enter yay directory${RESET}"; exit 1; } + makepkg -si + + cd .. + rm -rf "$temp_dir" + echo -e "${GREEN}:: Yay installed successfully.${RESET}" +} + +install_flatpak() { + if ! command -v flatpak &>/dev/null; then + echo -e "${YELLOW}:: Flatpak not found. Installing...${RESET}" + sudo dnf install -y flatpak + fi + flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo +} + +install_fedora_package() { + package_name="$1" + flatpak_id="$2" + + if sudo dnf list --available | grep -q "^$package_name"; then + gum spin --spinner dot --title "Installing $package_name via DNF..." -- sudo dnf install -y "$package_name" + else + echo -e "${YELLOW}:: $package_name not found in DNF. Falling back to Flatpak.${RESET}" + gum spin --spinner dot --title "Installing $package_name via Flatpak..." -- flatpak install -y flathub "$flatpak_id" fi } install_communication() { - install_paru + detect_distro + distro=$? + + if [[ $distro -eq 0 ]]; then + install_yay + pkg_manager="yay -S --noconfirm" + elif [[ $distro -eq 1 ]]; then + install_flatpak + pkg_manager="install_fedora_package" + else + echo -e "${RED}:: Unsupported system. Exiting.${RESET}" + return + fi + while true; do comm_choice=$(gum choose "Discord" "Better Discord" "Signal" "Telegram" "Keybase" "Exit") case $comm_choice in "Discord") - gum spin --spinner dot --title "Installing Discord..." -- paru -S --noconfirm discord && \ - version=$(pacman -Qi discord | grep Version | awk '{print $3}') && \ - gum format "🎉 **Discord installed successfully! Version: $version**" + if [[ $distro -eq 0 ]]; then + gum spin --spinner dot --title "Installing Discord..." -- $pkg_manager discord + else + $pkg_manager "discord" "com.discordapp.Discord" + fi ;; "Better Discord") - gum spin --spinner dot --title "Installing Better Discord..." -- paru -S --noconfirm betterdiscord-installer-bin&& \ - version=$(pacman -Qi betterdiscord-installer-bin | grep Version | awk '{print $3}') && \ - gum format "🎉 **Better Discord installed successfully! Version: $version**" + if [[ $distro -eq 0 ]]; then + gum spin --spinner dot --title "Installing Better Discord..." -- $pkg_manager betterdiscord-installer-bin + else + echo -e "${YELLOW}:: Better Discord is not available for Fedora.${RESET}" + fi ;; "Signal") - gum spin --spinner dot --title "Installing Signal..." -- paru -S --noconfirm signal-desktop && \ - version=$(pacman -Qi signal-desktop | grep Version | awk '{print $3}') && \ - gum format "🎉 **Signal installed successfully! Version: $version**" + if [[ $distro -eq 0 ]]; then + gum spin --spinner dot --title "Installing Signal..." -- $pkg_manager signal-desktop + else + $pkg_manager "signal-desktop" "org.signal.Signal" + fi ;; "Telegram") - gum spin --spinner dot --title "Installing Telegram..." -- paru -S --noconfirm telegram-desktop && \ - version=$(pacman -Qi telegram-desktop | grep Version | awk '{print $3}') && \ - gum format "🎉 **Telegram installed successfully! Version: $version**" + if [[ $distro -eq 0 ]]; then + gum spin --spinner dot --title "Installing Telegram..." -- $pkg_manager telegram-desktop + else + $pkg_manager "telegram-desktop" "org.telegram.desktop" + fi ;; "Keybase") - gum spin --spinner dot --title "Installing Keybase..." -- paru -S --noconfirm keybase-bin && \ - version=$(pacman -Qi keybase-bin | grep Version | awk '{print $3}') && \ - gum format "🎉 **Keybase installed successfully! Version: $version**" + if [[ $distro -eq 0 ]]; then + gum spin --spinner dot --title "Installing Keybase..." -- $pkg_manager keybase-bin + else + gum spin --spinner dot --title "Installing Keybase via RPM..." -- sudo dnf install -y https://prerelease.keybase.io/keybase_amd64.rpm + run_keybase + fi ;; "Exit") break @@ -67,21 +147,37 @@ install_communication() { } install_streaming() { - install_paru + detect_distro + distro=$? + + if [[ $distro -eq 0 ]]; then + install_yay + pkg_manager="sudo pacman -S --noconfirm" + elif [[ $distro -eq 1 ]]; then + pkg_manager="sudo dnf install -y" + else + echo -e "${RED}:: Unsupported system. Exiting.${RESET}" + return + fi + while true; do stream_choice=$(gum choose "OBS Studio" "SimpleScreenRecorder [Git]" "Exit") case $stream_choice in "OBS Studio") - gum spin --spinner dot --title "Installing OBS Studio..." -- sudo pacman -S --noconfirm obs-studio && \ - version=$(pacman -Qi obs-studio | grep Version | awk '{print $3}') && \ + gum spin --spinner dot --title "Installing OBS Studio..." -- $pkg_manager obs-studio + version=$([[ $distro -eq 0 ]] && pacman -Qi obs-studio | grep Version | awk '{print $3}' || rpm -q obs-studio) gum format "🎉 **OBS Studio installed successfully! Version: $version**" ;; "SimpleScreenRecorder [Git]") - gum confirm "The Git version builds from source and may take some time. Proceed?" && \ - gum spin --spinner dot --title "Installing SimpleScreenRecorder [Git]..." -- paru -S --noconfirm simplescreenrecorder-git && \ - version=$(pacman -Qi simplescreenrecorder-git | grep Version | awk '{print $3}') && \ - gum format "🎉 **SimpleScreenRecorder [Git] installed successfully! Version: $version**" + if [[ $distro -eq 0 ]]; then + gum confirm "The Git version builds from source and may take some time. Proceed?" && \ + gum spin --spinner dot --title "Installing SimpleScreenRecorder [Git]..." -- yay -S --noconfirm simplescreenrecorder-git && \ + version=$(pacman -Qi simplescreenrecorder-git | grep Version | awk '{print $3}') + gum format "🎉 **SimpleScreenRecorder [Git] installed successfully! Version: $version**" + else + echo -e "${YELLOW}:: SimpleScreenRecorder [Git] is not available on Fedora.${RESET}" + fi ;; "Exit") break @@ -91,19 +187,37 @@ install_streaming() { } install_editing() { + detect_distro + distro=$? + + if [[ $distro -eq 0 ]]; then + pkg_manager="sudo pacman -S --noconfirm" + elif [[ $distro -eq 1 ]]; then + pkg_manager="sudo dnf install -y" + else + echo -e "${RED}:: Unsupported system. Exiting.${RESET}" + return + fi + while true; do edit_choice=$(gum choose "GIMP (Image)" "Kdenlive (Videos)" "Exit") case $edit_choice in "GIMP (Image)") - gum spin --spinner dot --title "Installing GIMP..." -- sudo pacman -S --noconfirm gimp && \ - version=$(pacman -Qi gimp | grep Version | awk '{print $3}') && \ + gum spin --spinner dot --title "Installing GIMP..." -- $pkg_manager gimp + version=$([[ $distro -eq 0 ]] && pacman -Qi gimp | grep Version | awk '{print $3}' || rpm -q gimp) gum format "🎉 **GIMP installed successfully! Version: $version**" ;; "Kdenlive (Videos)") - gum spin --spinner dot --title "Installing Kdenlive..." -- sudo pacman -S --noconfirm kdenlive && \ - version=$(pacman -Qi kdenlive | grep Version | awk '{print $3}') && \ - gum format "🎉 **Kdenlive installed successfully! Version: $version**" + if [[ $distro -eq 0 ]]; then + gum spin --spinner dot --title "Installing Kdenlive..." -- $pkg_manager kdenlive + version=$(pacman -Qi kdenlive | grep Version | awk '{print $3}') + gum format "🎉 **Kdenlive installed successfully! Version: $version**" + else + gum spin --spinner dot --title "Installing Kdenlive on Fedora..." -- $pkg_manager kdenlive + version=$(rpm -q kdenlive) + gum format "🎉 **Kdenlive installed successfully! Version: $version**" + fi ;; "Exit") break @@ -112,6 +226,7 @@ install_editing() { done } + install_terminals() { install_paru while true; do diff --git a/scripts/Picom.sh b/scripts/Picom.sh index 5b99a577..a23eecec 100755 --- a/scripts/Picom.sh +++ b/scripts/Picom.sh @@ -16,20 +16,20 @@ Picom is a standalone compositor for Xorg. EOF echo -e "${ENDCOLOR}" -install_paru() { - if ! command -v paru &> /dev/null; then - echo -e "${RED}Paru is not installed. :: Installing Paru...${ENDCOLOR}" - sudo pacman -S --needed base-devel +install_aur_helper() { + if ! command -v yay &> /dev/null; then + echo -e "${RED}No AUR helper found. Installing yay...${ENDCOLOR}" + sudo pacman -S --needed git base-devel temp_dir=$(mktemp -d) cd "$temp_dir" || { echo -e "${RED}Failed to create temp directory${ENDCOLOR}"; exit 1; } - git clone https://aur.archlinux.org/paru.git - cd paru || { echo -e "${RED}Failed to enter paru directory${ENDCOLOR}"; exit 1; } + git clone https://aur.archlinux.org/yay.git + cd yay || { echo -e "${RED}Failed to enter yay directory${ENDCOLOR}"; exit 1; } makepkg -si cd .. rm -rf "$temp_dir" - echo -e "${GREEN}Paru installed successfully.${ENDCOLOR}" + echo -e "${GREEN}yay installed successfully.${ENDCOLOR}" else - echo -e "${GREEN}:: Paru is already installed.${ENDCOLOR}" + echo -e "${GREEN}:: yay is already installed.${ENDCOLOR}" fi } @@ -40,17 +40,60 @@ print_source_message() { install_dependencies_normal() { echo -e "${GREEN}:: Installing Picom...${ENDCOLOR}" - sudo pacman -S --needed picom + if [[ -f /etc/fedora-release ]]; then + sudo dnf install -y picom + else + sudo pacman -S --needed picom + fi } setup_picom_ftlabs() { - echo -e "${GREEN}:: Installing Picom FT-Labs (picom-ftlabs-git) via paru...${ENDCOLOR}" - paru -S picom-ftlabs-git --noconfirm + echo -e "${GREEN}:: Installing Picom FT-Labs (picom-ftlabs-git) via yay...${ENDCOLOR}" + yay -S picom-ftlabs-git --noconfirm +} + +install_picom_ftlabs_fedora() { + echo -e "${GREEN}:: Installing dependencies for Picom FT-Labs (Fedora)...${ENDCOLOR}" + sudo dnf install -y dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libXext-devel libxcb-devel libGL-devel libEGL-devel libepoxy-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel cmake + + echo -e "${GREEN}:: Cloning Picom FT-Labs repository...${ENDCOLOR}" + git clone https://github.com/FT-Labs/picom ~/.cache/picom + cd ~/.cache/picom || { echo -e "${RED}Failed to clone Picom repo.${ENDCOLOR}"; exit 1; } + + echo -e "${GREEN}:: Building Picom with meson and ninja...${ENDCOLOR}" + meson setup --buildtype=release build + ninja -C build + + echo -e "${GREEN}:: Installing the built Picom binary...${ENDCOLOR}" + sudo cp build/src/picom /usr/local/bin + sudo ldconfig + + echo -e "${GREEN}Done...${ENDCOLOR}" } download_config() { local config_url="$1" local config_path="$HOME/.config/picom.conf" + + if [ -f "$config_path" ]; then + echo -e "${YELLOW}:: picom.conf already exists in $HOME/.config. Do you want to overwrite it?${ENDCOLOR}" + choice=$(gum choose "Yes" "No") + + case "$choice" in + "Yes") + echo -e "${GREEN}:: Overwriting picom.conf...${ENDCOLOR}" + ;; + "No") + echo -e "${RED}:: Skipping picom.conf download...${ENDCOLOR}" + return 0 + ;; + *) + echo -e "${RED}Invalid option. Exiting...${ENDCOLOR}" + exit 1 + ;; + esac + fi + mkdir -p ~/.config echo -e "${GREEN}:: Downloading Picom configuration...${ENDCOLOR}" wget -O "$config_path" "$config_url" @@ -62,8 +105,12 @@ choice=$(gum choose "Picom with animation (FT-Labs)" "Picom normal" "Exit") case "$choice" in "Picom with animation (FT-Labs)") - install_paru - setup_picom_ftlabs + if [[ -f /etc/fedora-release ]]; then + install_picom_ftlabs_fedora + else + install_aur_helper + setup_picom_ftlabs + fi download_config "https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/picom/picom.conf" echo -e "${GREEN}:: Picom setup completed with animations from FT-Labs!${ENDCOLOR}" ;; diff --git a/scripts/Rofi.sh b/scripts/Rofi.sh index 7030611c..bea60806 100755 --- a/scripts/Rofi.sh +++ b/scripts/Rofi.sh @@ -1,12 +1,13 @@ #!/bin/bash -tput init -tput clear +clear + GREEN='\033[0;32m' CYAN='\033[0;36m' NC='\033[0m' BLUE="\e[34m" RED='\033[0;31m' +YELLOW='\033[0;33m' ENDCOLOR="\e[0m" echo -e "${BLUE}" @@ -14,18 +15,44 @@ figlet -f slant "Rofi" echo -e "${ENDCOLOR}" echo -e "${RED}:: WARNING: Make sure to back up your current Rofi configuration (if it exists).${ENDCOLOR}" +echo -e "${YELLOW}:: Note: JetBrains Mono Nerd Font is required for proper Rofi display. Please install it before continuing.${ENDCOLOR}" if ! gum confirm "Continue with Rofi setup?"; then echo -e "${RED}Setup aborted by the user.${NC}" exit 1 fi -setup_rofi() { +install_rofi_arch() { if ! command -v rofi &> /dev/null; then - echo -e "${CYAN}Rofi is not installed. :: Installing Rofi...${NC}" - sudo pacman -S rofi + echo -e "${CYAN}Rofi is not installed. :: Installing Rofi for Arch...${NC}" + sudo pacman -S --needed rofi else - echo -e "${GREEN}:: Rofi is already installed.${NC}" + echo -e "${GREEN}:: Rofi is already installed on Arch.${NC}" + fi +} + +install_rofi_fedora() { + if ! command -v rofi &> /dev/null; then + echo -e "${CYAN}Rofi is not installed. :: Installing Rofi for Fedora...${NC}" + sudo dnf install --assumeyes rofi + else + echo -e "${GREEN}:: Rofi is already installed on Fedora.${NC}" + fi +} + +setup_rofi() { + if [ -f /etc/os-release ]; then + . /etc/os-release + DISTRO=$ID + fi + + if [[ "$DISTRO" == "arch" || "$DISTRO" == "manjaro" ]]; then + install_rofi_arch + elif [[ "$DISTRO" == "fedora" ]]; then + install_rofi_fedora + else + echo -e "${RED}Unsupported distribution. Please install Rofi manually.${ENDCOLOR}" + exit 1 fi ROFI_CONFIG_DIR="$HOME/.config/rofi" @@ -33,13 +60,22 @@ setup_rofi() { if [ -d "$ROFI_CONFIG_DIR" ]; then echo -e "${CYAN}:: Rofi configuration directory exists. Backing up the current configuration...${NC}" - - if [ ! -d "$BACKUP_DIR" ]; then + + if [ -d "$BACKUP_DIR" ]; then + echo -e "${YELLOW}:: Backup already exists. Do you want to overwrite it?${NC}" + if gum confirm "Overwrite the existing backup?"; then + rm -rf "$BACKUP_DIR" + mkdir -p "$BACKUP_DIR" + mv "$ROFI_CONFIG_DIR"/* "$BACKUP_DIR"/ + echo -e "${GREEN}:: Existing Rofi configuration has been backed up to ~/.config/rofi_backup.${NC}" + else + echo -e "${GREEN}:: Keeping the existing backup. Skipping backup process.${NC}" + fi + else mkdir -p "$BACKUP_DIR" + mv "$ROFI_CONFIG_DIR"/* "$BACKUP_DIR"/ + echo -e "${GREEN}:: Existing Rofi configuration backed up to ~/.config/rofi_backup.${NC}" fi - - mv "$ROFI_CONFIG_DIR"/* "$BACKUP_DIR"/ - echo -e "${GREEN}:: Existing Rofi configuration backed up to ~/.config/rofi_backup.${NC}" else mkdir -p "$ROFI_CONFIG_DIR" fi @@ -57,3 +93,4 @@ setup_rofi() { } setup_rofi + diff --git a/scripts/Sddm.sh b/scripts/Sddm.sh index cf34ec85..ab2dd4cc 100755 --- a/scripts/Sddm.sh +++ b/scripts/Sddm.sh @@ -44,9 +44,17 @@ enable_sddm() { install_sddm() { if ! command -v sddm &> /dev/null; then echo -e "${GREEN}:: Installing SDDM...${ENDCOLOR}" - if ! sudo pacman -S sddm --noconfirm; then - echo -e "${RED}Failed to install SDDM. Exiting...${ENDCOLOR}" - exit 1 + + if [[ -f /etc/fedora-release ]]; then + if ! sudo dnf install -y sddm; then + echo -e "${RED}Failed to install SDDM on Fedora. Exiting...${ENDCOLOR}" + exit 1 + fi + else + if ! sudo pacman -S sddm --noconfirm; then + echo -e "${RED}Failed to install SDDM. Exiting...${ENDCOLOR}" + exit 1 + fi fi else echo -e "${GREEN}SDDM is already installed.${ENDCOLOR}" @@ -56,6 +64,17 @@ install_sddm() { install_theme() { local theme_dir="/usr/share/sddm/themes/" local theme_url="https://github.com/catppuccin/sddm/releases/download/v1.0.0/catppuccin-mocha.zip" + + if [ -d "$theme_dir/catppuccin-mocha" ]; then + echo -e "${RED}:: Catppuccin theme already exists.${ENDCOLOR}" + if gum confirm "Do you want to remove the existing theme and install a new one?"; then + echo -e "${GREEN}:: Removing the existing theme...${ENDCOLOR}" + sudo rm -rf "$theme_dir/catppuccin-mocha" + else + echo -e "${RED}:: Keeping the existing theme. Exiting...${ENDCOLOR}" + exit 1 + fi + fi echo -e "${GREEN}:: Downloading Catppuccin SDDM theme...${ENDCOLOR}" sudo mkdir -p "$theme_dir" @@ -94,10 +113,10 @@ fi echo -e "${GREEN}:: Proceeding with installation...${ENDCOLOR}" install_sddm -disable_other_dms -enable_sddm install_theme set_theme +disable_other_dms +enable_sddm echo -e "${GREEN}:: Setup complete. Please reboot your system to see the changes.${ENDCOLOR}" diff --git a/scripts/Themes-Icons.sh b/scripts/Themes-Icons.sh index 0586668b..e7f1ff78 100755 --- a/scripts/Themes-Icons.sh +++ b/scripts/Themes-Icons.sh @@ -7,16 +7,15 @@ BLUE='\033[0;34m' CYAN='\033[0;36m' YELLOW='\033[0;33m' RESET='\033[0m' -ENDCOLOR="\e[0m" echo -e "${BLUE}" figlet -f slant "Themes & Icons" -echo -e "${ENDCOLOR}" +echo -e "${RESET}" echo -e "${CYAN}Theme and Icon Setup${RESET}" echo -e "${YELLOW}----------------------${RESET}" -option=$(gum choose "Themes" "Icons" "Exit") +option=$(gum choose "Themes" "Icons" "Both" "Exit") check_and_create_dir() { if [ ! -d "$1" ]; then @@ -25,76 +24,94 @@ check_and_create_dir() { fi } -install_dependencies() { - echo -e "${BLUE}:: Installing dependencies...${RESET}" - if [ "$XDG_SESSION_TYPE" == "x11" ]; then - sudo pacman -S lxappearance qt5-base qt6-base kvantum --noconfirm - elif [ "$XDG_SESSION_TYPE" == "wayland" ]; then - sudo pacman -S nwg-look qt5-base qt6-base kvantum --noconfirm +check_existing_dir() { + if [ -d "$1" ]; then + echo -e "${YELLOW}:: $1 already exists. Do you want to overwrite?${RESET}" + if ! gum confirm "Continue?"; then + echo -e "${YELLOW}Operation canceled.${RESET}" + return 1 + fi + fi + return 0 +} + +clone_repo() { + local repo_url=$1 + local target_dir=$2 + + if [ -d "$target_dir" ]; then + echo -e "${YELLOW}:: $target_dir already exists. Skipping clone.${RESET}" else - echo -e "${YELLOW}Unknown session type.${RESET}" - exit 1 + git clone "$repo_url" "$target_dir" || { + echo -e "${RED}:: Failed to clone $repo_url. Exiting...${RESET}" + exit 1 + } fi } +cleanup_files() { + local target_dir=$1 + rm -f "$target_dir/LICENSE" "$target_dir/README.md" +} + setup_themes() { echo -e "${CYAN}:: Setting up Themes...${RESET}" - cd /tmp || exit + local tmp_dir="/tmp/themes" + clone_repo "https://github.com/harilvfs/themes" "$tmp_dir" - git clone https://github.com/harilvfs/themes - cd themes || exit + check_existing_dir "$HOME/.themes" || return + check_and_create_dir "$HOME/.themes" + + mv "$tmp_dir"/* "$HOME/.themes/" 2>/dev/null + cleanup_files "$HOME/.themes" - sudo mv * /usr/share/themes/ - check_and_create_dir "$HOME/.config/.themes" - mv * "$HOME/.config/.themes/" - - sudo rm -rf .git README.md LICENSE - - check_and_create_dir "$HOME/.config/Kvantum" - cp -r Kvantum "$HOME/.config/" + rm -rf "$tmp_dir" echo -e "${GREEN}:: Themes have been set up successfully.${RESET}" } setup_icons() { echo -e "${CYAN}:: Setting up Icons...${RESET}" - cd /tmp || exit + local tmp_dir="/tmp/icons" + clone_repo "https://github.com/harilvfs/icons" "$tmp_dir" - git clone https://github.com/harilvfs/icons - cd icons || exit + check_existing_dir "$HOME/.icons" || return + check_and_create_dir "$HOME/.icons" + + mv "$tmp_dir"/* "$HOME/.icons/" 2>/dev/null + cleanup_files "$HOME/.icons" - sudo mv * /usr/share/icons/ - check_and_create_dir "$HOME/.config/icons" - mv * "$HOME/.config/icons/" + rm -rf "$tmp_dir" - sudo rm -rf .git README.md LICENSE - - echo -e "${GREEN}Icons have been set up successfully.${RESET}" + echo -e "${GREEN}:: Icons have been set up successfully.${RESET}" } confirm_and_proceed() { - echo -e "${YELLOW}:: This will add themes to themes & icons directories, but you will need to manually select them using the appropriate app for your window manager (lxappearance for X11, nwg-look for Wayland).${RESET}" + echo -e "${YELLOW}:: This will install themes and icons, but you must select them manually using lxappearance (X11) or nwg-look (Wayland).${RESET}" if ! gum confirm "Do you want to continue?"; then - echo -e "${YELLOW}Operation canceled. Press Enter to return to the submenu.${RESET}" - read -r - exec "$0" + echo -e "${YELLOW}Operation canceled.${RESET}" + exit 0 fi } case "$option" in - "Setup Themes") - confirm_and_proceed - install_dependencies + "Themes") + confirm_and_proceed setup_themes echo -e "${BLUE}:: Use lxappearance for X11 or nwg-look for Wayland to select the theme.${RESET}" ;; - "Setup Icons") - confirm_and_proceed - install_dependencies + "Icons") + confirm_and_proceed setup_icons echo -e "${BLUE}:: Use lxappearance for X11 or nwg-look for Wayland to select the icons.${RESET}" ;; + "Both") + confirm_and_proceed + setup_themes + setup_icons + echo -e "${BLUE}:: Use lxappearance for X11 or nwg-look for Wayland to select the theme and icons.${RESET}" + ;; "Exit") echo -e "${YELLOW}:: Exiting...${RESET}" exit 0 diff --git a/scripts/Tmux.sh b/scripts/Tmux.sh index 6edc853d..752f8494 100755 --- a/scripts/Tmux.sh +++ b/scripts/Tmux.sh @@ -10,6 +10,7 @@ RESET="\e[0m" dependencies=("tmux" "figlet" "gum" "wget" "git") missing=() + for dep in "${dependencies[@]}"; do if ! command -v "$dep" &>/dev/null; then missing+=("$dep") @@ -17,15 +18,23 @@ for dep in "${dependencies[@]}"; do done if [[ ${#missing[@]} -ne 0 ]]; then - echo -e "${RED}The following dependencies are missing: ${missing[*]}${RESET}" - echo -e "${YELLOW}Please install them before running this script.${RESET}" - exit 1 + echo -e "${RED}Missing dependencies: ${missing[*]}${RESET}" + echo -e "${YELLOW}Installing missing dependencies...${RESET}" + + if command -v pacman &>/dev/null; then + sudo pacman -S --noconfirm "${missing[@]}" + elif command -v dnf &>/dev/null; then + sudo dnf install -y "${missing[@]}" + else + echo -e "${RED}Unsupported package manager. Install dependencies manually.${RESET}" + exit 1 + fi fi -echo -e "${BLUE}" - -figlet "Tmux" +clear +echo -e "${BLUE}" +figlet -f slant "Tmux" echo -e "${RESET}" if ! gum confirm "Do you want to proceed with the tmux installation and configuration?"; then @@ -34,55 +43,78 @@ if ! gum confirm "Do you want to proceed with the tmux installation and configur fi if ! command -v tmux &>/dev/null; then - echo -e "${YELLOW}tmux is not installed. Installing tmux...${RESET}" - sudo pacman -S --noconfirm tmux + echo -e "${YELLOW}Tmux is not installed. Installing...${RESET}" + + if command -v pacman &>/dev/null; then + sudo pacman -S --noconfirm tmux + elif command -v dnf &>/dev/null; then + sudo dnf install -y tmux + fi fi config_dir="$HOME/.config/tmux" +backup_dir="$HOME/.config/tmux.bak" + if [[ -d "$config_dir" ]]; then - backup_dir="$HOME/.config/tmux.bak" - echo -e "${BLUE}Found existing tmux configuration. Backing up to $backup_dir...${RESET}" - mv "$config_dir" "$backup_dir" + echo -e "${YELLOW}Existing tmux configuration detected.${RESET}" + if gum confirm "Do you want to backup the existing configuration?"; then + if [[ -d "$backup_dir" ]]; then + echo -e "${YELLOW}Backup already exists.${RESET}" + if gum confirm "Do you want to overwrite the backup?"; then + rm -rf "$backup_dir" + else + echo -e "${RED}Exiting to prevent data loss.${RESET}" + exit 0 + fi + fi + mv "$config_dir" "$backup_dir" + else + echo -e "${RED}Exiting to avoid overwriting existing config.${RESET}" + exit 0 + fi fi tpm_dir="$HOME/.tmux/plugins/tpm" + if [[ -d "$tpm_dir" ]]; then - echo -e "${YELLOW}TPM already exists at $tpm_dir. Skipping clone.${RESET}" -else - echo -e "${GREEN}Cloning Tmux Plugin Manager (TPM)...${RESET}" - git clone https://github.com/tmux-plugins/tpm "$tpm_dir" + echo -e "${YELLOW}TPM is already installed.${RESET}" + if gum confirm "Do you want to overwrite TPM?"; then + rm -rf "$tpm_dir" + else + echo -e "${RED}Skipping TPM installation.${RESET}" + fi fi -cd "$tpm_dir" || exit -chmod +x tpm -./tpm +echo -e "${GREEN}Cloning TPM...${RESET}" +git clone https://github.com/tmux-plugins/tpm "$tpm_dir" mkdir -p "$config_dir" config_url="https://raw.githubusercontent.com/harilvfs/dwm/refs/heads/main/config/tmux/tmux.conf" -echo -e "${GREEN}Downloading tmux configuration file...${RESET}" +echo -e "${GREEN}Downloading tmux configuration...${RESET}" wget -O "$config_dir/tmux.conf" "$config_url" -plugin_script_dir="$HOME/.tmux/plugins/tpm/scripts/" -echo -e "${GREEN}Installing tmux plugins...${RESET}" -cd "$plugin_script_dir" || exit -chmod +x ./*.sh -./install_plugins.sh - -echo -e "${GREEN}Updating tmux plugins...${RESET}" -./update_plugin.sh - -shell_rc=("$HOME/.zshrc" "$HOME/.bashrc") -startup_line="if [ -z \"$TMUX\" ]; then\n tmux attach -d || tmux new\nfi" -for rc in "${shell_rc[@]}"; do - if [[ -f "$rc" ]]; then - if ! grep -Fxq "$startup_line" "$rc"; then - echo -e "${GREEN}Adding tmux auto-start to $rc...${RESET}" - echo -e "$startup_line" >>"$rc" - else - echo -e "${YELLOW}Tmux auto-start already present in $rc.${RESET}" - fi - fi -done +plugin_script_dir="$tpm_dir/scripts" + +if [[ -d "$plugin_script_dir" ]]; then + echo -e "${GREEN}Installing tmux plugins...${RESET}" + cd "$plugin_script_dir" || exit + chmod +x install_plugins.sh + ./install_plugins.sh +else + echo -e "${RED}TPM scripts not found. Skipping plugin installation.${RESET}" +fi + +echo -e "${GREEN}Running TPM...${RESET}" +cd "$tpm_dir" || exit +chmod +x tpm +./tpm + +if [[ $? -ne 0 ]]; then + echo -e "${RED}TPM encountered an error.${RESET}" + echo -e "${YELLOW}Try running tmux and then executing:${RESET}" + echo -e "${GREEN}~/.tmux/plugins/tpm/tpm${RESET}" +fi + +echo -e "${GREEN}Tmux setup complete!${RESET}" -echo -e "${GREEN}Tmux setup and configuration completed successfully.${RESET}"