Files
dotfiles/install.sh
T
tekki 350fb4fe59 initial dotfiles setup
Profile-based dotfiles with switchable color themes.
Structure: profiles/ with themes/ and config/ per profile.
2026-04-21 17:41:08 +02:00

64 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
set -e
PROFILE_DIR="$(cd "$(dirname "$0")" && pwd)"
PROFILE_NAME="$(basename "$PROFILE_DIR")"
echo "Installing profile: $PROFILE_NAME"
CONFIG_DIRS=(hypr waybar dunst kitty wofi gtk-3.0 gtk-4.0 wal)
# Symlink each config dir (backup real dirs first)
for dir in "${CONFIG_DIRS[@]}"; do
source="$PROFILE_DIR/config/$dir"
target="$HOME/.config/$dir"
[[ ! -d "$source" ]] && continue
if [[ -d "$target" && ! -L "$target" ]]; then
echo " backing up $target -> ${target}.bak"
mv "$target" "${target}.bak"
fi
ln -sfn "$source" "$target"
echo " linked ~/.config/$dir"
done
# Set active profile
ln -sfn "$PROFILE_DIR" "$HOME/.active_profile"
echo " active profile -> $PROFILE_NAME"
# Set default theme if none is active yet, or active theme is not from this profile
current_theme=$(readlink "$HOME/.active_theme" 2>/dev/null || echo "")
if [[ -z "$current_theme" || ! "$current_theme" == "$PROFILE_DIR/themes/"* ]]; then
default_theme=$(ls "$PROFILE_DIR/themes/" | sort | head -1)
ln -sfn "$PROFILE_DIR/themes/$default_theme" "$HOME/.active_theme"
echo " active theme -> $default_theme"
fi
# Install global scripts to ~/.local/bin
mkdir -p "$HOME/.local/bin"
for script in "$PROFILE_DIR/scripts/"*.sh; do
name=$(basename "$script")
cp "$script" "$HOME/.local/bin/${name%.sh}"
chmod +x "$HOME/.local/bin/${name%.sh}"
echo " installed ~/.local/bin/${name%.sh}"
done
# Make sure ~/.local/bin is in PATH
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then
echo ""
echo "NOTE: Add ~/.local/bin to your PATH if not already done:"
echo " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc"
fi
# Load theme
echo ""
echo "Loading theme..."
~/.config/wal/reload.sh
echo ""
echo "Profile '$PROFILE_NAME' installed."
echo ""
echo "To install required packages run:"
echo " sudo pacman -S \$(grep -v '^#' '$PROFILE_DIR/packages.txt' | grep -v '^\s*$' | grep -v '^#.*AUR' | tr '\n' ' ')"
echo " # AUR packages (with yay/paru): see packages.txt"