#!/bin/bash

used=$(sensors -j | jq '."amdgpu-pci-0900"."edge"."temp1_input"')

# Choix de la couleur
if [[ $used -ge 90 ]]
then color="#f2777a"
elif [[ $used -ge 70 ]]
then color="#f99157"
elif [[ $used -ge 50 ]]
then color="#ffcc66"
elif [[ $used -ge 10 ]]
then color="#99cc99"
else color="#66cccc"
fi

# Affichage
printf "gpu<span foreground=\"%s\">%3d°C</span>\n" "$color" "$used"
