better structure
This commit is contained in:
27
scripts/installer/final.sh
Normal file
27
scripts/installer/final.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Source helper file
|
||||
source $SCRIPT_DIR/helper.sh
|
||||
|
||||
log_message "Final setup script started"
|
||||
print_bold_blue "\nCongratulations! Your Simple Hyprland setup is complete!"
|
||||
|
||||
print_bold_blue "\nRepository Information:"
|
||||
echo " - GitHub Repository: https://github.com/gaurav210233/simple-hyprland"
|
||||
echo " - If you found this repo helpful, please consider giving it a star on GitHub!"
|
||||
|
||||
print_bold_blue "\nContribute:"
|
||||
echo " - We welcome contributions! Whether it's bug fixes, new features, or documentation improvements."
|
||||
echo " - Feel free to open issues, submit pull requests, or provide feedback."
|
||||
echo " - Every contribution, big or small, is valuable to the community."
|
||||
|
||||
print_bold_blue "\nTroubleshooting:"
|
||||
echo " - If you encounter any issues, please check the GitHub issues section."
|
||||
echo " - Don't hesitate to open a new issue if you can't find a solution to your problem."
|
||||
|
||||
print_success "\nEnjoy your new Hyprland environment!"
|
||||
|
||||
echo "------------------------------------------------------------------------"
|
||||
164
scripts/installer/helper.sh
Executable file
164
scripts/installer/helper.sh
Executable file
@@ -0,0 +1,164 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Color codes
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[0;33m'
|
||||
BLUE='\033[0;34m'
|
||||
BOLD='\033[1m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Log file
|
||||
LOG_FILE="$SCRIPT_DIR/simple_hyprland_install.log"
|
||||
|
||||
function trap_message {
|
||||
print_error "\n\nScript interrupted. Exiting.....\n"
|
||||
# Add any cleanup code here
|
||||
log_message "Script interrupted and exited"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Function to log messages
|
||||
function log_message {
|
||||
echo "$(date): $1" >> "$LOG_FILE"
|
||||
}
|
||||
|
||||
# Functions for colored/bold output
|
||||
function print_error {
|
||||
echo -e "${RED}$1${NC}"
|
||||
}
|
||||
|
||||
function print_success {
|
||||
echo -e "${GREEN}$1${NC}"
|
||||
}
|
||||
|
||||
function print_warning {
|
||||
echo -e "${YELLOW}$1${NC}"
|
||||
}
|
||||
|
||||
function print_info {
|
||||
echo -e "${BLUE}$1${NC}"
|
||||
}
|
||||
|
||||
function print_bold_blue {
|
||||
echo -e "${BLUE}${BOLD}$1${NC}"
|
||||
}
|
||||
|
||||
# Function to ask for confirmation
|
||||
function ask_confirmation {
|
||||
while true; do
|
||||
read -p "$(print_warning "$1 (y/n): ")" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
log_message "Operation accepted by user."
|
||||
return 0 # User confirmed
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
log_message "Operation cancelled by user."
|
||||
print_error "Operation cancelled."
|
||||
return 1 # User cancelled
|
||||
else
|
||||
print_error "Invalid input. Please answer y or n."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Function to run a command with optional confirmation and retry
|
||||
function run_command {
|
||||
local cmd="$1"
|
||||
local description="$2"
|
||||
local ask_confirm="${3:-yes}" # Default to asking for confirmation
|
||||
local use_sudo="${4:-yes}" # Default to using sudo
|
||||
|
||||
log_message "Attempting to run: $description"
|
||||
|
||||
if [[ "$ask_confirm" == "yes" ]]; then
|
||||
if ! ask_confirmation "\n$description"; then
|
||||
print_info "$description was skipped."
|
||||
log_message "$description was skipped by user choice."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
print_info "\n$description" # Echo what it's doing without confirmation
|
||||
fi
|
||||
|
||||
local full_cmd=""
|
||||
if [[ "$use_sudo" == "no" ]]; then
|
||||
full_cmd="sudo -u $SUDO_USER $cmd"
|
||||
else
|
||||
full_cmd="$cmd"
|
||||
fi
|
||||
|
||||
while ! eval "$full_cmd"; do
|
||||
print_error "Command failed."
|
||||
log_message "Command failed: $cmd"
|
||||
if [[ "$ask_confirm" == "yes" ]]; then
|
||||
if ! ask_confirmation "Retry $description?"; then
|
||||
print_warning "$description was not completed."
|
||||
log_message "$description was not completed due to failure and user chose not to retry."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
print_warning "$description failed and will not be retried."
|
||||
log_message "$description failed and was not retried (auto mode)."
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
print_success "$description completed successfully."
|
||||
log_message "$description completed successfully."
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to run a script with retry and confirmation
|
||||
function run_script {
|
||||
local script="$SCRIPT_DIR/$1"
|
||||
local description="$2"
|
||||
if ask_confirmation "\nExecute '$description' script"; then
|
||||
while ! bash "$script"; do
|
||||
print_error "$description script failed."
|
||||
if ! ask_confirmation "Retry $description"; then
|
||||
return 1 # User chose not to retry
|
||||
fi
|
||||
done
|
||||
print_success "\n$description completed successfully."
|
||||
else
|
||||
return 1 # User chose not to run the script
|
||||
fi
|
||||
}
|
||||
|
||||
function check_root {
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
print_error "Please run as root"
|
||||
log_message "Script not run as root. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Store the original user for later use
|
||||
SUDO_USER=$(logname)
|
||||
log_message "Original user is $SUDO_USER"
|
||||
}
|
||||
|
||||
function check_os {
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
if [[ "$ID" != "arch" ]]; then
|
||||
print_warning "This script is designed for Arch Linux. Your system: $PRETTY_NAME"
|
||||
if ! ask_confirmation "Continue anyway?"; then
|
||||
log_message "Installation cancelled due to unsupported OS"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_success "Arch Linux detected. Proceeding with installation."
|
||||
log_message "Arch Linux detected. Installation proceeding."
|
||||
fi
|
||||
else
|
||||
print_error "Unable to determine OS. /etc/os-release not found."
|
||||
if ! ask_confirmation "Continue anyway?"; then
|
||||
log_message "Installation cancelled due to unknown OS"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
24
scripts/installer/hypr.sh
Normal file
24
scripts/installer/hypr.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Source helper file
|
||||
source $SCRIPT_DIR/helper.sh
|
||||
|
||||
log_message "Installation started for hypr section"
|
||||
print_info "\nStarting hypr setup..."
|
||||
|
||||
run_command "pacman -S --noconfirm hyprland" "Install Hyprland (Must)" "yes"
|
||||
run_command "cp ~/simple-hyprland/configs/hypr/hyprland.conf ~/.config/hypr/" "Copy hyprland config (Must)" "yes" #no
|
||||
|
||||
run_command "pacman -S --noconfirm xdg-desktop-portal-hyprland" "Install XDG desktop portal for Hyprland" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm polkit-kde-agent" "Install KDE Polkit agent for authentication dialogs" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm dunst" "Install Dunst notification daemon (Recommended)" "yes"
|
||||
run_command "cp -r ~/simple-hyprland/configs/dunst ~/.config/" "Copy dunst config" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm qt5-wayland qt6-wayland" "Install QT support on wayland" "yes"
|
||||
|
||||
echo "------------------------------------------------------------------------"
|
||||
31
scripts/installer/install.sh
Executable file
31
scripts/installer/install.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Source helper file
|
||||
source $SCRIPT_DIR/helper.sh
|
||||
|
||||
# Trap for unexpected exits
|
||||
trap 'trap_message' INT TERM
|
||||
|
||||
# Script start
|
||||
log_message "Installation started"
|
||||
print_bold_blue "\nSimple Hyprland"
|
||||
echo "---------------"
|
||||
|
||||
# Check if running as root
|
||||
check_root
|
||||
|
||||
# Check if OS is Arch Linux
|
||||
check_os
|
||||
|
||||
# Run child scripts
|
||||
run_script "prerequisites.sh" "Prerequisites Setup"
|
||||
run_script "hypr.sh" "Hyprland & Critical Softwares Setup"
|
||||
run_script "utilities.sh" "Basic Utilities & Configs Setup"
|
||||
run_script "theming.sh" "Themes and Tools Setup"
|
||||
run_script "final.sh" "Final Setup"
|
||||
|
||||
print_bold_blue "\n🌟 Setup Complete\n"
|
||||
log_message "Installation completed successfully"
|
||||
30
scripts/installer/prerequisites.sh
Executable file
30
scripts/installer/prerequisites.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Source helper file
|
||||
source $SCRIPT_DIR/helper.sh
|
||||
|
||||
log_message "Installation started for prerequisites section"
|
||||
print_info "\nStarting prerequisites setup..."
|
||||
|
||||
run_command "pacman -Syyu --noconfirm" "Update package database and upgrade packages (Recommended)" "yes" # no
|
||||
|
||||
run_command "pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si && cd.. # builds with makepkg" "Install YAY (Must)" "yes" # no
|
||||
|
||||
run_command "pacman -S --noconfirm pipewire wireplumber" "Configuring audio (Recommended)" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm ttf-cascadia-code-nerd ttf-cascadia-mono-nerd ttf-fira-code ttf-fira-mono ttf-fira-sans ttf-firacode-nerd ttf-iosevka-nerd ttf-iosevkaterm-nerd ttf-jetbrains-mono-nerd ttf-jetbrains-mono ttf-nerd-fonts-symbols ttf-nerd-fonts-symbols ttf-nerd-fonts-symbols-mono" "Installing Nerd Fonts and Symbols (Recommended)" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm sddm && systemctl enable sddm.service" "Install and enable SDDM (Recommended)" "yes"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm brave-bin" "Install Brave Browser" "yes" "no"
|
||||
|
||||
run_command "pacman -S --noconfirm kitty" "Install Kitty (Recommended)" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm nano" "Install nano" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm tar" "Install tar for extracting files (Must)" "yes"
|
||||
|
||||
echo "------------------------------------------------------------------------"
|
||||
31
scripts/installer/theming.sh
Normal file
31
scripts/installer/theming.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Source helper file
|
||||
source $SCRIPT_DIR/helper.sh
|
||||
|
||||
log_message "Installation started for theming section"
|
||||
print_info "\nStarting theming setup..."
|
||||
|
||||
run_command "pacman -S --noconfirm nwg-look" "Install nwg-look for GTK theme management" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm qt5ct qt6ct kvantum" "Install Qt5, Qt6 Settings, and Kvantum theme engines" "yes"
|
||||
|
||||
run_command "tar -xvf ~/simple-hyprland/assets/themes/Catppuccin-Mocha.tar.xz -C /usr/share/themes/" "Install Catppuccin Mocha GTK theme" "yes"
|
||||
|
||||
run_command "tar -xvf ~/simple-hyprland/assets/icons/Tela-circle-dracula.tar.xz -C /usr/share/icons/" "Install Tela Circle Dracula icon theme" "yes"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm kvantum-theme-catppuccin-git" "Install Catppuccin theme for Kvantum" "yes" "no"
|
||||
|
||||
run_command "cp -r ~/simple-hyprland/configs/kitty ~/.config/" "Copy Catppuccin theme configuration for Kitty terminal" "yes"
|
||||
|
||||
# Add instructions to configure theming
|
||||
print_info "\nPost-installation instructions:"
|
||||
print_bold_blue "Set themes and icons:"
|
||||
echo " - Run 'nwg-look' and set the global GTK and icon theme"
|
||||
echo " - Open 'kvantummanager' (run with sudo for system-wide changes) to select and apply the Catppuccin theme"
|
||||
echo " - Open 'qt6ct' to set the icon theme"
|
||||
|
||||
echo "------------------------------------------------------------------------"
|
||||
36
scripts/installer/utilities.sh
Normal file
36
scripts/installer/utilities.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Source helper file
|
||||
source $SCRIPT_DIR/helper.sh
|
||||
|
||||
log_message "Installation started for utilities section"
|
||||
print_info "\nStarting utilities setup..."
|
||||
|
||||
run_command "pacman -S --noconfirm waybar" "Install Waybar - Status Bar" "yes"
|
||||
run_command "cp -r ~/simple-hyprland/configs/waybar ~/.config/" "Copy Waybar config" "yes"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm tofi" "Install Tofi - Application Launcher" "yes" "no"
|
||||
run_command "cp -r ~/simple-hyprland/configs/tofi ~/.config/" "Copy Tofi config(s)" "yes"
|
||||
|
||||
run_command "pacman -S --noconfirm cliphist" "Install Cliphist - Clipboard Manager" "yes"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm swww" "Install SWWW for wallpaper management" "yes" "no"
|
||||
run_command "cp -r ~/simple-hyprland/assets/backgrounds ~/.config/assets/backgrounds/" "Copy sample wallpapers to assets directory (Recommended)" "yes"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm hyprpicker" "Install Hyprpicker - Color Picker" "yes" "no"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm hyprlock" "Install Hyprlock - Screen Locker (Must)" "yes" "no"
|
||||
run_command "cp ~/simple-hyprland/configs/hypr/hyprlock.conf ~/.config/hypr/" "Copy Hyprlock config" "yes"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm wlogout" "Install Wlogout - Session Manager" "yes" "no"
|
||||
run_command "cp -r ~/simple-hyprland/configs/wlogout ~/.config/ && cp -r ~/simple-hyprland/assets/wlogout ~/.config/assets/" "Copy Wlogout config and assets" "yes"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm grimblast" "Install Grimblast - Screenshot tool" "yes" "no"
|
||||
|
||||
run_command "yay -S --sudoloop --noconfirm hypridle" "Install Hypridle for idle management (Must)" "yes" "no"
|
||||
run_command "cp ~/simple-hyprland/configs/hypr/hypridle.conf ~/.config/hypr/" "Copy Hypridle config" "yes"
|
||||
|
||||
echo "------------------------------------------------------------------------"
|
||||
Reference in New Issue
Block a user