Files
hyprarch/install.sh

334 lines
9.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# ╔═══════════════════════════════════════════════════════════════════╗
# ║ HYPRARCH - Install Script ║
# ║ https://git.cribdev.com/crib/hyprarch ║
# ╚═══════════════════════════════════════════════════════════════════╝
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Banner
echo -e "${CYAN}"
cat << "EOF"
╦ ╦╦ ╦╔═╗╦═╗╔═╗╦═╗╔═╗╦ ╦
╠═╣╚╦╝╠═╝╠╦╝╠═╣╠╦╝║ ╠═╣
╩ ╩ ╩ ╩ ╩╚═╩ ╩╩╚═╚═╝╩ ╩
Hyprland Rice for Arch Linux
EOF
echo -e "${NC}"
# Check if running as root
if [ "$EUID" -eq 0 ]; then
echo -e "${RED}Error: Please don't run this script as root${NC}"
exit 1
fi
# Check if running Arch Linux
if [ ! -f /etc/arch-release ]; then
echo -e "${RED}Error: This script is designed for Arch Linux${NC}"
exit 1
fi
# Function to print status
print_status() {
echo -e "${BLUE}[*]${NC} $1"
}
print_success() {
echo -e "${GREEN}[✓]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[!]${NC} $1"
}
print_error() {
echo -e "${RED}[✗]${NC} $1"
}
# Get script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# ── Step 1: Update System ────────────────────────────────────────────
print_status "Updating system..."
sudo pacman -Syu --noconfirm
# ── Step 2: Install yay (AUR helper) ─────────────────────────────────
if ! command -v yay &> /dev/null; then
print_status "Installing yay (AUR helper)..."
sudo pacman -S --needed --noconfirm git base-devel
git clone https://aur.archlinux.org/yay.git /tmp/yay
cd /tmp/yay && makepkg -si --noconfirm
cd "$SCRIPT_DIR"
rm -rf /tmp/yay
print_success "yay installed"
else
print_success "yay already installed"
fi
# ── Step 3: Install Packages ─────────────────────────────────────────
print_status "Installing packages..."
# Core Hyprland packages
HYPRLAND_PKGS=(
hyprland
hyprpaper
hyprpicker
hypridle
hyprlock
xdg-desktop-portal-hyprland
)
# Wayland essentials
WAYLAND_PKGS=(
waybar
rofi-wayland
dunst
swww
grim
slurp
wl-clipboard
)
# System utilities
SYSTEM_PKGS=(
kitty
thunar
thunar-archive-plugin
file-roller
pavucontrol
brightnessctl
networkmanager
network-manager-applet
bluez
bluez-utils
blueman
pipewire
pipewire-alsa
pipewire-pulse
pipewire-jack
wireplumber
)
# Fonts
FONT_PKGS=(
ttf-jetbrains-mono-nerd
ttf-fira-code
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
ttf-font-awesome
)
# CLI tools
CLI_PKGS=(
git
vim
neovim
htop
btop
wget
curl
unzip
zip
ripgrep
fd
fzf
bat
eza
jq
zsh
starship
)
# Applications
APP_PKGS=(
firefox
imv
zathura
zathura-pdf-mupdf
mpv
)
# Qt/GTK theming
THEME_PKGS=(
qt5ct
qt6ct
nwg-look
)
# Install official packages
print_status "Installing official packages..."
sudo pacman -S --needed --noconfirm "${HYPRLAND_PKGS[@]}" "${WAYLAND_PKGS[@]}" "${SYSTEM_PKGS[@]}" "${FONT_PKGS[@]}" "${CLI_PKGS[@]}" "${APP_PKGS[@]}" "${THEME_PKGS[@]}"
# AUR packages
AUR_PKGS=(
swaynotificationcenter
)
print_status "Installing AUR packages..."
yay -S --needed --noconfirm "${AUR_PKGS[@]}"
print_success "All packages installed"
# ── Step 4: Enable Services ──────────────────────────────────────────
print_status "Enabling services..."
sudo systemctl enable NetworkManager
sudo systemctl enable bluetooth
systemctl --user enable pipewire pipewire-pulse wireplumber
print_success "Services enabled"
# ── Step 5: Backup Existing Configs ──────────────────────────────────
print_status "Backing up existing configs..."
BACKUP_DIR="$HOME/.config-backup-$(date +%Y%m%d_%H%M%S)"
configs_to_backup=(
"$HOME/.config/hypr"
"$HOME/.config/waybar"
"$HOME/.config/rofi"
"$HOME/.config/kitty"
"$HOME/.config/dunst"
)
mkdir -p "$BACKUP_DIR"
for config in "${configs_to_backup[@]}"; do
if [ -d "$config" ] || [ -f "$config" ]; then
cp -r "$config" "$BACKUP_DIR/" 2>/dev/null || true
print_warning "Backed up $(basename $config)"
fi
done
print_success "Backup created at $BACKUP_DIR"
# ── Step 6: Install Configs ──────────────────────────────────────────
print_status "Installing configs..."
# Create directories
mkdir -p "$HOME/.config/hypr"
mkdir -p "$HOME/.config/waybar"
mkdir -p "$HOME/.config/rofi"
mkdir -p "$HOME/.config/kitty"
mkdir -p "$HOME/.config/dunst"
mkdir -p "$HOME/Pictures/wallpapers"
mkdir -p "$HOME/Pictures/screenshots"
# Copy configs
cp -r "$SCRIPT_DIR/.config/hypr/"* "$HOME/.config/hypr/"
cp -r "$SCRIPT_DIR/.config/waybar/"* "$HOME/.config/waybar/"
cp -r "$SCRIPT_DIR/.config/rofi/"* "$HOME/.config/rofi/"
cp -r "$SCRIPT_DIR/.config/kitty/"* "$HOME/.config/kitty/"
cp -r "$SCRIPT_DIR/.config/dunst/"* "$HOME/.config/dunst/"
# Copy wallpapers if they exist
if [ -d "$SCRIPT_DIR/wallpapers" ] && [ "$(ls -A $SCRIPT_DIR/wallpapers 2>/dev/null)" ]; then
cp -r "$SCRIPT_DIR/wallpapers/"* "$HOME/Pictures/wallpapers/"
fi
print_success "Configs installed"
# ── Step 7: Set Zsh as Default Shell ─────────────────────────────────
if [ "$SHELL" != "$(which zsh)" ]; then
print_status "Setting zsh as default shell..."
chsh -s $(which zsh)
print_success "Zsh set as default shell (will take effect on next login)"
fi
# ── Step 8: Install Starship Config ──────────────────────────────────
print_status "Installing starship config..."
mkdir -p "$HOME/.config"
cat > "$HOME/.config/starship.toml" << 'EOF'
add_newline = false
format = "$directory$git_branch$git_status$character"
[directory]
truncation_length = 3
truncate_to_repo = true
[character]
success_symbol = "[](bold green)"
error_symbol = "[](bold red)"
[git_branch]
format = "[$symbol$branch]($style) "
style = "bold purple"
EOF
print_success "Starship config installed"
# ── Step 9: Setup Zsh Config ─────────────────────────────────────────
print_status "Setting up zsh config..."
cat > "$HOME/.zshrc" << 'EOF'
# HYPRARCH - Zsh Config
# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory
setopt sharehistory
setopt hist_ignore_dups
# Completion
autoload -Uz compinit
compinit
# Aliases
alias ls='eza'
alias ll='eza -la'
alias cat='bat'
alias vim='nvim'
alias update='sudo pacman -Syu'
alias cleanup='sudo pacman -Rns $(pacman -Qtdq)'
# Starship prompt
eval "$(starship init zsh)"
EOF
print_success "Zsh config installed"
# ── Step 10: Download Default Wallpaper ──────────────────────────────
print_status "Downloading default wallpaper..."
if command -v wget &> /dev/null; then
wget -q "https://raw.githubusercontent.com/linuxdotexe/nordic-wallpapers/master/wallpapers/ign_astronaut.png" -O "$HOME/Pictures/wallpapers/default.jpg" 2>/dev/null || \
wget -q "https://images.unsplash.com/photo-1557682250-33bd709cbe85?w=1920" -O "$HOME/Pictures/wallpapers/default.jpg" 2>/dev/null || \
print_warning "Could not download wallpaper, please add one manually"
fi
print_success "Wallpaper downloaded"
# ── Complete ─────────────────────────────────────────────────────────
echo ""
echo -e "${GREEN}╔═══════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Installation Complete! ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e "${CYAN}Next steps:${NC}"
echo " 1. Log out and select Hyprland from your display manager"
echo " 2. Or start Hyprland from TTY: ${YELLOW}Hyprland${NC}"
echo ""
echo -e "${CYAN}Keybindings:${NC}"
echo " SUPER + Return → Terminal (Kitty)"
echo " SUPER + D → App Launcher (Rofi)"
echo " SUPER + Q → Close Window"
echo " SUPER + E → File Manager"
echo " SUPER + 1-9 → Switch Workspace"
echo ""
echo -e "${CYAN}Config locations:${NC}"
echo " Hyprland: ~/.config/hypr/hyprland.conf"
echo " Waybar: ~/.config/waybar/"
echo " Rofi: ~/.config/rofi/"
echo " Kitty: ~/.config/kitty/kitty.conf"
echo ""
echo -e "${YELLOW}Backup of old configs: $BACKUP_DIR${NC}"
echo ""
echo -e "${GREEN}Enjoy your new rice! 🎨${NC}"