#!/usr/bin/env bash # Dotfiles setup script for Arch Linux using paru set -e #!/usr/bin/env bash # Dotfiles setup script for Arch Linux using paru set -e # Device profile detection (unified via host-profiles.conf) HOSTNAME=$(hostname) DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)" DOTFILES_DEVICE="" if [ -f "$DOTFILES_DIR/host-profiles.conf" ]; then DOTFILES_DEVICE=$(awk -F= -v h="$HOSTNAME" '$1==h{print $2}' "$DOTFILES_DIR/host-profiles.conf") fi if [ -z "$DOTFILES_DEVICE" ]; then echo "ERROR: No device profile mapping found for hostname '$HOSTNAME' in $DOTFILES_DIR/host-profiles.conf" exit 1 fi export DOTFILES_DEVICE echo "Using device profile: $DOTFILES_DEVICE" # Find, sort, and run all modules in the modules directory SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" MODULES=( $(find "$SCRIPT_DIR/modules" -maxdepth 1 -type f -name "*.sh" | sort) ) COUNT=${#MODULES[@]} for i in "${!MODULES[@]}"; do MODULE="${MODULES[$i]}" STEP=$((i+1)) BASENAME=$(basename "$MODULE") echo "[$STEP/$COUNT] Running $BASENAME..." source "$MODULE" done if pgrep -x Hyprland >/dev/null; then echo "Reloading Hyprland config..." hyprctl reload else echo "Hyprland is not running; skipping reload." fi