desktop-setup/scripts/misc/nerd-font.sh
2025-07-08 21:57:02 -04:00

32 lines
784 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
FONT_DIR="$HOME/.local/share/fonts"
FONT_FILE="$FONT_DIR/HackNerdFont-Regular.ttf"
ZIP_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Hack.zip"
ZIP_DEST="/tmp/Hack.zip"
# Check if font is already installed
if [[ -f "$FONT_FILE" ]]; then
echo "Hack Nerd Font is already installed. Skipping."
exit 0
fi
echo "Hack Nerd Font not found. Proceeding with installation..."
echo "Ensuring font directory exists at $FONT_DIR"
mkdir -p "$FONT_DIR"
chmod 755 "$FONT_DIR"
echo "Downloading Hack Nerd Font zip..."
curl -L "$ZIP_URL" -o "$ZIP_DEST"
echo "Unzipping font files to $FONT_DIR..."
unzip -o "$ZIP_DEST" -d "$FONT_DIR"
echo "Refreshing font cache..."
fc-cache -fv
echo "Hack Nerd Font installed successfully."