Skip to content

Instantly share code, notes, and snippets.

@AxDSan
Created November 28, 2025 18:16
Show Gist options
  • Select an option

  • Save AxDSan/611c8c322dc38cb61fad5e2ebb5201c3 to your computer and use it in GitHub Desktop.

Select an option

Save AxDSan/611c8c322dc38cb61fad5e2ebb5201c3 to your computer and use it in GitHub Desktop.
Make Fastfetch Nicer!
#!/usr/bin/env bash
# =============================================================================
# Robust fastfetch config installer with backups and safety checks
# Author: You (or me πŸ˜‰)
# Config source: https://github.com/harilvfs/fastfetch (old-days branch)
# =============================================================================
set -euo pipefail # Strict mode: exit on error, undefined var, or pipe failure
CONFIG_URL="https://raw.githubusercontent.com/harilvfs/fastfetch/refs/heads/old-days/fastfetch/config.jsonc"
TARGET_DIR="$HOME/.config/fastfetch"
TARGET_FILE="$TARGET_DIR/config.jsonc"
BACKUP_DIR="$TARGET_DIR/backups"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_FILE="$BACKUP_DIR/config.jsonc.backup.$TIMESTAMP"
echo "πŸš€ Installing custom fastfetch config (old-days theme)"
# 1. Check if fastfetch is even installed
if ! command -v fastfetch >/dev/null 2>&1; then
echo "⚠️ fastfetch is not installed. Installing it first is recommended."
echo " On Debian/Ubuntu: sudo apt install fastfetch"
echo " On Arch: sudo pacman -S fastfetch"
echo " On Fedora: sudo dnf install fastfetch"
read -p "Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 1
fi
fi
# 2. Create directories
mkdir -p "$TARGET_DIR"
mkdir -p "$BACKUP_DIR"
# 3. Backup existing config if it exists and is not a symlink
if [[ -f "$TARGET_FILE" && ! -L "$TARGET_FILE" ]]; then
echo "πŸ’Ύ Backing up existing config β†’ $BACKUP_FILE"
cp "$TARGET_FILE" "$BACKUP_FILE"
echo " (Old configs are kept forever in $BACKUP_DIR)"
fi
# 4. Download the new config with retry logic
echo "⬇️ Downloading custom config..."
for i in {1..5}; do
if wget --quiet --timeout=10 --tries=1 -O "$TARGET_FILE.tmp" "$CONFIG_URL"; then
mv "$TARGET_FILE.tmp" "$TARGET_FILE"
echo "βœ“ Config downloaded and installed successfully!"
break
else
echo "⚠️ Download attempt $i failed, retrying in 3 seconds..."
sleep 3
fi
done
# Final check
if [[ ! -f "$TARGET_FILE" ]]; then
echo "βœ— Failed to download the config after 5 attempts."
echo " Check your internet or try again later."
exit 1
fi
# 5. Optional: show a preview (if fastfetch works)
if command -v fastfetch >/dev/null 2>&1; then
echo "πŸ–ΌοΈ Preview (close with Ctrl+C if it hangs):"
echo "────────────────────────────────────────────"
timeout 8 fastfetch || true
echo "────────────────────────────────────────────"
fi
echo
echo "βœ… All done!"
echo " β€’ Your old config(s) are safely backed up in:"
echo " $BACKUP_DIR"
echo " β€’ Just close & reopen your terminal (or run 'exec \$SHELL')"
echo " β€’ Then type: fastfetch"
echo
echo "Enjoy the nostalgia! πŸ•ΉοΈ"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment