#!/usr/bin/env bash

# Get system stats
cpu_usage=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | sed 's/%us,//')
memory_usage=$(free | grep '^Mem:' | awk '{printf "%.0f", $3/$2 * 100}')
disk_usage=$(df -h / | awk 'NR==2{print $5}')
uptime=$(uptime -p | sed 's/up //')

# Get temperature if available
temp="N/A"
if [ -f /sys/class/thermal/thermal_zone0/temp ]; then
    temp_raw=$(cat /sys/class/thermal/thermal_zone0/temp)
    temp="$((temp_raw / 1000))°C"
fi

# Format stats
stats="CPU: ${cpu_usage}%
RAM: ${memory_usage}%
Disk: ${disk_usage}
Temp: ${temp}
Up: ${uptime}"

# Send notification
notify-send -t 5000 -a "stats" -u low "$stats"