ccd02e718b
Dropped xfwm for awesomewm Themed it accordingly, theme, icons, cursor, rofi Cleaned up picom for awesome and made better animations Install script cleanup and removed unneeded tools
202 lines
5.9 KiB
Bash
Executable File
202 lines
5.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# ---------------------------------------------------------------------------------
|
|
## GLOBAL VARS
|
|
# ---------------------------------------------------------------------------------
|
|
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
## Parse arguments
|
|
# ---------------------------------------------------------------------------------
|
|
DO_LINKS=false
|
|
DO_INSTALL=false
|
|
CONFIRM_MODE=true # only true when no args are passed
|
|
|
|
usage() {
|
|
echo "Usage: $0 [-l] [-i]"
|
|
echo " -l Only create symlinks (no confirmation)"
|
|
echo " -i Only install system packages (no confirmation)"
|
|
echo " (no args = do both, with confirmation)"
|
|
exit 1
|
|
}
|
|
|
|
if [ $# -eq 0 ]; then
|
|
DO_LINKS=true
|
|
DO_INSTALL=true
|
|
CONFIRM_MODE=true
|
|
else
|
|
CONFIRM_MODE=false
|
|
while getopts ":lih" opt; do
|
|
case $opt in
|
|
l) DO_LINKS=true ;;
|
|
i) DO_INSTALL=true ;;
|
|
h) usage ;;
|
|
*) usage ;;
|
|
esac
|
|
done
|
|
fi
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
## Helper function for linking
|
|
# ---------------------------------------------------------------------------------
|
|
link_file() {
|
|
local src="$1"
|
|
local dest="$2"
|
|
|
|
if [ -L "$dest" ]; then
|
|
if [ "$(readlink "$dest")" == "$src" ]; then
|
|
echo "✅ Symlink already correct: $dest → $src"
|
|
((SKIPPED++))
|
|
else
|
|
echo "⚠️ $dest is a symlink but points to the wrong target."
|
|
echo " Replacing with correct symlink..."
|
|
rm "$dest"
|
|
ln -s "$src" "$dest"
|
|
echo "🔁 Fixed: $dest → $src"
|
|
((CREATED++))
|
|
fi
|
|
elif [ -e "$dest" ]; then
|
|
echo "⚠️ $dest exists but is not a symlink. Skipping."
|
|
((SKIPPED++))
|
|
else
|
|
mkdir -p "$(dirname "$dest")"
|
|
ln -s "$src" "$dest"
|
|
echo "✅ Linked: $dest → $src"
|
|
((CREATED++))
|
|
fi
|
|
}
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
## LINK SYMLINKS
|
|
# ---------------------------------------------------------------------------------
|
|
if [ "$DO_LINKS" = true ]; then
|
|
if [ "$CONFIRM_MODE" = true ]; then
|
|
read -p "❓ Do you want to create symlinks for your dotfiles? [y/N] " confirm
|
|
case "$confirm" in
|
|
[Yy]*) ;; # continue below
|
|
*) DO_LINKS=false ;;
|
|
esac
|
|
fi
|
|
fi
|
|
|
|
if [ "$DO_LINKS" = true ]; then
|
|
echo "🔗 Checking and creating symlinks..."
|
|
CREATED=0
|
|
SKIPPED=0
|
|
|
|
link_file "$DOTFILES_DIR/config/kanata" "$HOME/.config/kanata"
|
|
link_file "$DOTFILES_DIR/config/fish" "$HOME/.config/fish"
|
|
link_file "$DOTFILES_DIR/config/alacritty" "$HOME/.config/alacritty"
|
|
link_file "$DOTFILES_DIR/config/lf" "$HOME/.config/lf"
|
|
link_file "$DOTFILES_DIR/config/picom" "$HOME/.config/picom"
|
|
link_file "$DOTFILES_DIR/config/awesome" "$HOME/.config/awesome"
|
|
link_file "$DOTFILES_DIR/config/rofi" "$HOME/.config/rofi"
|
|
link_file "$DOTFILES_DIR/config/nvim" "$HOME/.config/nvim"
|
|
link_file "$DOTFILES_DIR/scripts/bin" "$HOME/.local/bin"
|
|
|
|
echo ""
|
|
echo "🧾 Summary: $CREATED symlink(s) created or fixed, $SKIPPED skipped."
|
|
echo ""
|
|
|
|
echo "✅ Symlink setup complete."
|
|
echo ""
|
|
fi
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
## INSTALL SYSTEM PACKAGES
|
|
# ---------------------------------------------------------------------------------
|
|
if [ "$DO_INSTALL" = true ]; then
|
|
if [ "$CONFIRM_MODE" = true ]; then
|
|
read -p "❓ Do you want to install system packages? [y/N] " confirm
|
|
case "$confirm" in
|
|
[Yy]*) ;; # continue below
|
|
*) DO_INSTALL=false ;;
|
|
esac
|
|
fi
|
|
fi
|
|
|
|
if [ "$DO_INSTALL" = true ]; then
|
|
|
|
# -----------------------------------------------------------------------------
|
|
## ADD NONFREE REPOS
|
|
# -----------------------------------------------------------------------------
|
|
echo "📦 Checking nonfree repositories..."
|
|
|
|
REPO_PACKAGES=(void-repo-nonfree)
|
|
|
|
# Only add multilib-nonfree on x86_64
|
|
if [ "$(uname -m)" = "x86_64" ]; then
|
|
REPO_PACKAGES+=(void-repo-multilib-nonfree)
|
|
fi
|
|
|
|
MISSING_REPOS=()
|
|
for repo in "${REPO_PACKAGES[@]}"; do
|
|
if ! xbps-query -p pkgver "$repo" >/dev/null 2>&1; then
|
|
MISSING_REPOS+=("$repo")
|
|
fi
|
|
done
|
|
|
|
if [ ${#MISSING_REPOS[@]} -eq 0 ]; then
|
|
echo "✅ Nonfree repositories already enabled."
|
|
else
|
|
echo "📦 Enabling repositories: ${MISSING_REPOS[*]}"
|
|
sudo xbps-install -Sy "${MISSING_REPOS[@]}"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# -----------------------------------------------------------------------------
|
|
## INSTALL REQUIRED PACKAGES
|
|
# -----------------------------------------------------------------------------
|
|
REQUIRED_PACKAGES=(
|
|
# network & download
|
|
wget curl ca-certificates gnupg rsync
|
|
# core utilities
|
|
git unzip jq fzf tree direnv make
|
|
# modern cli replacements
|
|
lf fd ripgrep bat delta lazygit
|
|
# shell & terminal
|
|
fish-shell alacritty
|
|
# build & dev tools
|
|
base-devel valgrind tree-sitter-cli go
|
|
# system
|
|
pfetch fuse
|
|
# window manager & desktop
|
|
picom xdotool wmctrl polybar rofi kanata
|
|
# fonts
|
|
noto-fonts-ttf noto-fonts-emoji
|
|
)
|
|
|
|
MISSING_PACKAGES=()
|
|
|
|
echo "🔍 Checking for missing packages..."
|
|
echo ""
|
|
|
|
# Check which packages are missing using xbps-query
|
|
for pkg in "${REQUIRED_PACKAGES[@]}"; do
|
|
if ! xbps-query -p pkgver "$pkg" >/dev/null 2>&1; then
|
|
MISSING_PACKAGES+=("$pkg")
|
|
fi
|
|
done
|
|
|
|
if [ ${#MISSING_PACKAGES[@]} -eq 0 ]; then
|
|
echo "✅ All required packages are already installed."
|
|
else
|
|
echo "📦 Syncing repository indexes..."
|
|
sudo xbps-install -S
|
|
|
|
echo "📦 Installing missing packages: ${MISSING_PACKAGES[*]}"
|
|
sudo xbps-install "${MISSING_PACKAGES[@]}"
|
|
fi
|
|
|
|
echo ""
|
|
echo "✅ Package setup complete."
|
|
echo ""
|
|
fi
|
|
# TODO: these need to go somewhere!
|
|
# xfconf-query -c xfce4-session -np '/shutdown/ShowSuspend' -t 'bool' -s 'false'
|
|
# xfconf-query -c xfce4-session -np '/shutdown/ShowHibernate' -t 'bool' -s 'false'
|
|
# xfconf-query -c xfce4-session -np '/shutdown/ShowHybridSleep' -t 'bool' -s 'false'
|
|
# xfconf-query -c xfce4-session -np '/shutdown/ShowSwitchUser' -t 'bool' -s 'false'
|
|
# xfconf-query -c xfwm4 -p /general/placement_ratio -s 100
|
|
# xfconf-query -c xfwm4 -p /general/use_compositing -s false
|