#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" # ---------------------------- # UI helpers # ---------------------------- info() { echo -e "\033[1;34m[INFO]\033[0m $*"; } ok() { echo -e "\033[1;32m[ OK ]\033[0m $*"; } warn() { echo -e "\033[1;33m[WARN]\033[0m $*"; } fail() { echo -e "\033[1;31m[FAIL]\033[0m $*"; } # ---------------------------- # Packages # ---------------------------- REQUIRED_PKGS=( hyprland-qt-support hyprcursor hypridle hyprlock libnotify jq inetutils tmux ) OPTIONAL_PKGS=( hyprpaper "Wallpaper daemon" OFF carla "Audio plugin host" OFF gnome-keyring "Secrets management" OFF curl "HTTP requests" OFF wofi "Launcher" OFF kitty "Terminal" OFF nautilus "File manager" OFF wtype "Typing tool" OFF ydotool "Input automation" OFF imagemagick "Image tools" OFF playerctl "Media control" OFF wlopm "Monitor power" OFF hyprshot "Screenshot tool" OFF matugen "Theme generator" OFF ) # ---------------------------- # Optional selection (ONLY whiptail use) # ---------------------------- command -v whiptail &>/dev/null || { fail "whiptail is required for selection" exit 1 } info "Selecting optional packages..." SELECTED=$(whiptail --title "Optional Packages" --checklist \ "Select extras to install:" 18 70 10 \ "${OPTIONAL_PKGS[@]}" \ 3>&1 1>&2 2>&3) || { fail "Cancelled" exit 1 } OPT_ARGS=() [[ -n "${SELECTED:-}" ]] && eval "OPT_ARGS=($SELECTED)" ok "Selection complete" # ---------------------------- # Config setup # ---------------------------- info "Preparing config files..." mkdir -p "$SCRIPT_DIR/scripts/autostart" [[ ! -f "$SCRIPT_DIR/scripts/autostart/workspace" ]] && { cp "$SCRIPT_DIR/examples/workspace.example" "$SCRIPT_DIR/scripts/autostart/workspace" ok "workspace config created" } [[ ! -f "$SCRIPT_DIR/hyprlock.conf" ]] && { cp "$SCRIPT_DIR/examples/hyprlock.conf.example" "$SCRIPT_DIR/hyprlock.conf" ok "hyprlock config created" } [[ ! -f "$SCRIPT_DIR/hyprpaper.conf" ]] && { cp "$SCRIPT_DIR/examples/hyprpaper.conf.example" "$SCRIPT_DIR/hyprpaper.conf" ok "hyprpaper config created" } # ---------------------------- # Install # ---------------------------- info "Updating system..." sudo pacman -Syu --noconfirm ok "System updated" info "Installing required packages..." sudo pacman -S --needed --noconfirm "${REQUIRED_PKGS[@]}" ok "Required packages installed" if [[ ${#OPT_ARGS[@]} -gt 0 ]]; then info "Installing optional packages..." sudo pacman -S --needed --noconfirm "${OPT_ARGS[@]}" ok "Optional packages installed" else warn "No optional packages selected" fi # ---------------------------- # Done # ---------------------------- echo ok "Setup complete" info "Restart Hyprland to apply changes"