dotfiles/.config/xmobar/scripts/cpu_temp.sh

23 lines
598 B
Bash
Raw Normal View History

2022-10-31 21:00:11 +00:00
#!/bin/sh
temp1=70
temp2=85
amd_or_intel=$(sensors | grep 'Package id 0:')
if [$amd_or_intel == ""]
then
temp=$(sensors | grep 'AMD' | head -n 1 | grep -Po '\+\d+.+°C ' | sed -En 's/\+(.*)\..*°C/\1/p')
else
temp=$(sensors | grep 'Package id 0:' | awk '{print $4}' | sed 's/+//'| sed 's/.0°C//')
fi
if [ "$temp" -ge "$temp2" ] ; then
2024-09-07 03:05:26 +01:00
echo "<fc=#7C6F64><fn=6></fn></fc> <fc=#FB4934> $temp°C</fc>"
2022-10-31 21:00:11 +00:00
elif [ "$temp" -ge "$temp1" ] ; then
2024-09-07 03:05:26 +01:00
echo "<fc=#7C6F64><fn=6></fn></fc> <fc=#FE8019> $temp°C</fc>"
2022-10-31 21:00:11 +00:00
else
2024-09-07 03:05:26 +01:00
echo "<fc=#7C6F64><fn=6></fn></fc> <fc=#B8BB26> $temp°C</fc>"
2022-10-31 21:00:11 +00:00
fi