#!/usr/bin/env bash

# hyprfetch.sh — a little fetch for your Hyprland setup

# colours (true-color ANSI)
ACCENT='\033[38;2;79;132;204m'    # #4F84CC
FOREGROUND='\033[38;2;202;211;232m' # #CAD3E8
RESET='\033[0m'

# helper to print a labeled field
print_field() {
  printf "${ACCENT}%-10s${FOREGROUND}%s${RESET}\n" "$1:" "$2"
}

# ASCII Art Hyprland logo (simplified)
printf "${ACCENT}"
cat <<'EOF'
 __  __               
|  \/  |__ _ _ _ ___  
| |\/| / _` | '_/ -_) 
|_|  |_\__,_|_| \___| 
EOF
printf "${RESET}\n"

# now the fields
print_field "OS"       "$(grep '^PRETTY_NAME=' /etc/os-release | cut -d= -f2 | tr -d '"')"
print_field "Kernel"   "$(uname -r)"
print_field "Uptime"   "$(uptime -p)"
print_field "Shell"    "$(basename "$SHELL")"
print_field "WM"       "Hyprland $(hyprctl version | grep -oP '\d+\.\d+\.\d+')"

# hardware
print_field "CPU"      "$(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2 | sed 's/^ //')"
print_field "RAM"      "$(free -h | awk '/^Mem:/ {print $3 \" / \" $2}')"
if command -v acpi &>/dev/null; then
  print_field "Battery" "$(acpi -b | awk -F', ' '{print $2 \" — \" $3}')"
fi

