19 lines
815 B
Bash
Executable File

#!/bin/bash
# Get CPU temp from k10temp (Tctl)
cpu_temp=$(sensors k10temp-pci-00c3 2>/dev/null | grep 'Tctl:' | awk '{print $2}' | sed 's/+//;s/°C//')
# Get GPU temp from amdgpu
gpu_temp=$(sensors amdgpu-pci-1600 2>/dev/null | grep 'edge:' | awk '{print $2}' | sed 's/+//;s/°C//')
# Get Coolant temp from Kraken
coolant_temp=$(sensors kraken2023-hid-3-9 2>/dev/null | grep 'Coolant' | awk '{print $3}' | sed 's/+//;s/°C//')
# Round temps
cpu_temp=$(printf "%.0f" "$cpu_temp" 2>/dev/null || echo "N/A")
gpu_temp=$(printf "%.0f" "$gpu_temp" 2>/dev/null || echo "N/A")
coolant_temp=$(printf "%.0f" "$coolant_temp" 2>/dev/null || echo "N/A")
# Output
echo "{\"text\":\" ${cpu_temp}° ${gpu_temp}° ${coolant_temp}°\", \"tooltip\":\"CPU: ${cpu_temp}°C | GPU: ${gpu_temp}°C | Coolant: ${coolant_temp}°C\"}"