#!/usr/bin/env bash # System stats: GPU temp, CPU temp, memory usage (BreadOnPenguins style) # Nerd Font icons, color-coded temps, click for details CPU_TEMP=$(sensors | awk ' /^Package id|^Core 0|^Tdie|^CPU/ { gsub(/[+°C]/, ""); for (i=1; i<=NF; i++) { if ($i ~ /^[0-9]+(\.[0-9]+)?$/) { gsub(/\..*/, "", $i); print $i; exit; } } }') [ -z "$CPU_TEMP" ] && CPU_TEMP="N/A" # AMD GPU (edge/junction) GPU_TEMP=$(sensors | awk '/^edge|^junction/ {gsub(/\+/,""); gsub(/\..*/,"",$2); print $2; exit}') # NVIDIA fallback if [ -z "$GPU_TEMP" ] && command -v nvidia-smi >/dev/null 2>&1; then GPU_TEMP=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader) fi [ -z "$GPU_TEMP" ] && GPU_TEMP="N/A" MEM_USE=$(free -m | awk '/^Mem/ {printf "%.1f", ($3)/1024}') # CPU icon based on temp case $CPU_TEMP in "N/A") CPU_ICON="󰍛 ?" ;; [7-9][6-9]|[8-9][0-9]|100) CPU_ICON="" ;; [6][6-9]|7[0-5]) CPU_ICON="󰍛" ;; *) CPU_ICON="󰍛" ;; esac # GPU icon based on temp case $GPU_TEMP in "N/A") GPU_ICON="󰢮 ?" ;; [7-9][1-9]|[8-9][0-9]|100) GPU_ICON="" ;; [5][1-9]|70) GPU_ICON="󰢮" ;; *) GPU_ICON="󰢮" ;; esac echo "$GPU_ICON ${GPU_TEMP}° $CPU_ICON ${CPU_TEMP}° ${MEM_USE}g" case $BLOCK_BUTTON in 1) setsid -w -f "$TERMINAL" -e htop ;; 3) notify-send "󰍛 System Stats" "CPU: ${CPU_TEMP}°C\nGPU: ${GPU_TEMP}°C\nRAM: ${MEM_USE} GB" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac