#!/usr/bin/env bash set -euo pipefail # Arch Linux bootstrap for this dotfiles setup. # Installs the packages required by configs in this repository. if ! command -v pacman >/dev/null 2>&1; then echo "This installer currently supports Arch Linux (pacman) only." exit 1 fi PACKAGES=( # Core desktop/session hyprland hyprpaper waybar xdg-desktop-portal xdg-desktop-portal-hyprland # Terminal + launcher + file manager alacritty wofi thunar # Audio/network/system controls used by config pipewire wireplumber pavucontrol playerctl brightnessctl networkmanager network-manager-applet # Wayland screenshot stack + notifications grim slurp swappy wl-clipboard libnotify # Utilities used by scripts/config curl btop tmux fzf xclip kdeconnect ) REQUIRED_COMMANDS=( hyprland hyprpaper waybar alacritty wofi thunar wpctl playerctl brightnessctl grim slurp swappy wl-copy notify-send curl btop ) echo "Installing packages for dotfiles setup..." sudo pacman -S --needed --noconfirm "${PACKAGES[@]}" missing=() for cmd in "${REQUIRED_COMMANDS[@]}"; do if ! command -v "$cmd" >/dev/null 2>&1; then missing+=("$cmd") fi done if (( ${#missing[@]} > 0 )); then echo echo "Install completed, but these commands are still missing:" printf ' - %s\n' "${missing[@]}" echo "Check package names/repos on your system and install them manually." exit 2 fi echo echo "Install complete." echo "Next steps:" echo "1) Symlink/copy dotfiles into ~/.config and ~/.tmux.conf" echo "2) Enable/start NetworkManager if needed: sudo systemctl enable --now NetworkManager" echo "3) Start Hyprland" #!/usr/bin/env bash # install.sh — bootstrap dotfiles on a fresh Arch/CachyOS install # Usage: ./install.sh [--dry-run] set -euo pipefail DOTFILES="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DRY_RUN=false [[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true # ------------------------------------------------------- # Helpers # ------------------------------------------------------- info() { echo -e "\e[34m[INFO]\e[0m $*"; } ok() { echo -e "\e[32m[ OK ]\e[0m $*"; } warn() { echo -e "\e[33m[WARN]\e[0m $*"; } error() { echo -e "\e[31m[ERR ]\e[0m $*"; } dry() { echo -e "\e[90m[DRY ]\e[0m $*"; } run() { if $DRY_RUN; then dry "$*" else "$@" fi } # ------------------------------------------------------- # 1. Check: Wayland / Hyprland environment # ------------------------------------------------------- info "Checking display server..." if [[ -z "${WAYLAND_DISPLAY:-}" && -z "${XDG_SESSION_TYPE:-}" ]]; then warn "WAYLAND_DISPLAY not set — are you running a Wayland session?" elif [[ "${XDG_SESSION_TYPE:-}" == "x11" ]]; then- warn "Session type is X11. Hyprland and Waybar require Wayland." else ok "Wayland session detected (${XDG_SESSION_TYPE:-wayland})" fi # ------------------------------------------------------- # 2. Check: Required programs # ------------------------------------------------------- info "Checking required programs..." REQUIRED=( hyprland waybar hyprpaper alacritty grim slurp swappy wl-copy wofi thunar btop nm-connection-editor kdeconnect-indicator expac pavucontrol notify-send ) MISSING=() for cmd in "${REQUIRED[@]}"; do if command -v "$cmd" &>/dev/null; then ok " $cmd" else warn " $cmd — NOT FOUND" MISSING+=("$cmd") fi done if [[ ${#MISSING[@]} -gt 0 ]]; then warn "Missing programs: ${MISSING[*]}" read -rp "Install missing packages with yay now? [y/N] " ans if [[ "${ans,,}" == "y" ]]; then run yay -S --needed "${MISSING[@]}" else warn "Skipping package install — some features may not work." fi else ok "All required programs found." fi # ------------------------------------------------------- # 3. Check: Required fonts # ------------------------------------------------------- info "Checking fonts..." FONTS=( ttf-sourcecodepro-nerd ttf-nerd-fonts-symbols ttf-nerd-fonts-symbols-mono otf-font-awesome ) MISSING_FONTS=() for pkg in "${FONTS[@]}"; do if pacman -Q "$pkg" &>/dev/null; then ok " $pkg" else warn " $pkg — NOT INSTALLED" MISSING_FONTS+=("$pkg") fi done if [[ ${#MISSING_FONTS[@]} -gt 0 ]]; then read -rp "Install missing fonts with yay now? [y/N] " ans if [[ "${ans,,}" == "y" ]]; then run yay -S --needed "${MISSING_FONTS[@]}" run fc-cache -fv else warn "Skipping font install — icons in Waybar may not render." fi else ok "All required fonts installed." fi # ------------------------------------------------------- # 4. Symlinks # ------------------------------------------------------- info "Creating symlinks..." symlink() { local src="$1" local dst="$2" local parent parent="$(dirname "$dst")" if [[ ! -e "$src" ]]; then error "Source does not exist: $src — skipping" return fi run mkdir -p "$parent" if [[ -L "$dst" ]]; then local current current="$(readlink "$dst")" if [[ "$current" == "$src" ]]; then ok " $dst (already linked)" return else warn " $dst points elsewhere ($current) — relinking" run ln -sfn "$src" "$dst" fi elif [[ -e "$dst" ]]; then local bak="${dst}.bak.$(date +%Y%m%d_%H%M%S)" warn " $dst exists — backing up to $bak" run mv "$dst" "$bak" run ln -s "$src" "$dst" else run ln -s "$src" "$dst" ok " $dst → $src" fi } symlink "$DOTFILES/.bashrc" "$HOME/.bashrc" symlink "$DOTFILES/.config/hypr" "$HOME/.config/hypr" symlink "$DOTFILES/.config/waybar" "$HOME/.config/waybar" symlink "$DOTFILES/.config/alacritty" "$HOME/.config/alacritty" symlink "$DOTFILES/.local/bin/waybar" "$HOME/.local/bin/waybar" # Ensure waybar scripts are executable if [[ -d "$DOTFILES/.config/waybar/scripts" ]]; then run chmod +x "$DOTFILES/.config/waybar/scripts/"*.sh ok "Waybar scripts marked executable" fi # ------------------------------------------------------- # 5. Check: NAS mount points # ------------------------------------------------------- info "Checking NAS mount points..." for mnt in /mnt/data /mnt/usb1; do if mountpoint -q "$mnt" 2>/dev/null; then ok " $mnt is mounted" elif [[ -d "$mnt" ]]; then warn " $mnt exists but is not mounted" else warn " $mnt does not exist — Waybar mount checks will show unmounted" run sudo mkdir -p "$mnt" fi done # ------------------------------------------------------- # Done # ------------------------------------------------------- echo "" ok "Dotfiles installed! Start a new shell or run: source ~/.bashrc" if command -v hyprland &>/dev/null; then ok "Log out and back in to start Hyprland with Waybar." fi