diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..feae199 --- /dev/null +++ b/.bashrc @@ -0,0 +1,51 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# ------------------------------------------------------- +# Core +# ------------------------------------------------------- + +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias c='clear' + +# ------------------------------------------------------- +# Build +# ------------------------------------------------------- + +alias make="make -j$(nproc)" +alias ninja="ninja -j$(nproc)" +alias n='ninja' + +# ------------------------------------------------------- +# Pacman / AUR +# ------------------------------------------------------- + +alias update='sudo pacman -Syu' +alias rmpkg='sudo pacman -Rsn' +alias cleanch='sudo pacman -Scc' +alias fixpacman='sudo rm /var/lib/pacman/db.lck' +alias cleanup='sudo pacman -Rsn $(pacman -Qtdq)' + +# Help people coming from Debian/Ubuntu +alias apt='man pacman' +alias apt-get='man pacman' + +# ------------------------------------------------------- +# Utilities +# ------------------------------------------------------- + +alias please='sudo' +alias tb='nc termbin.com 9999' +alias jctl='journalctl -p 3 -xb' +alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl" + +# ------------------------------------------------------- +# Prompt +# ------------------------------------------------------- + +PS1='[\u@\h \W]\$ ' diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml new file mode 100644 index 0000000..c59e7df --- /dev/null +++ b/.config/alacritty/alacritty.toml @@ -0,0 +1,50 @@ +[colors.bright] +black = "#4c566a" +blue = "#81a1c1" +cyan = "#8fbcbb" +green = "#a3be8c" +magenta = "#b48ead" +red = "#bf616a" +white = "#eceff4" +yellow = "#ebcb8b" + +[colors.cursor] +cursor = "#d8dee9" +text = "#2e3440" + +[colors.dim] +black = "#373e4d" +blue = "#68809a" +cyan = "#6d96a5" +green = "#809575" +magenta = "#8c738c" +red = "#94545d" +white = "#aeb3bb" +yellow = "#b29e75" + +[colors.normal] +black = "#3b4252" +blue = "#81a1c1" +cyan = "#88c0d0" +green = "#a3be8c" +magenta = "#b48ead" +red = "#bf616a" +white = "#e5e9f0" +yellow = "#ebcb8b" + +[colors.primary] +background = "#2e3440" +dim_foreground = "#a5abb6" +foreground = "#d8dee9" + +[colors.search.matches] +background = "#88c0d0" +foreground = "CellBackground" + +[colors.selection] +background = "#4c566a" +text = "CellForeground" + +[colors.vi_mode_cursor] +cursor = "#d8dee9" +text = "#2e3440" diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..91da969 --- /dev/null +++ b/install.sh @@ -0,0 +1,201 @@ +#!/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