frobar: Display temperature for other CPU types

This commit is contained in:
Geoffrey Frogeye 2024-06-17 19:30:48 +02:00
parent a3fcaf9d27
commit d6d3df65df
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -144,16 +144,20 @@ class RamProvider(AlertingSection, PeriodicUpdater):
class TemperatureProvider(AlertingSection, PeriodicUpdater):
NUMBER_STATES = 2
RAMP = ""
MAIN_TEMPS = ["coretemp", "amdgpu", "cpu_thermal"]
# For Intel, AMD and ARM respectively.
def fetcher(self):
allTemp = psutil.sensors_temperatures()
if "coretemp" not in allTemp:
# TODO Opti Remove interval
return ""
temp = allTemp["coretemp"][0]
for main in self.MAIN_TEMPS:
if main in allTemp:
break
else:
return "?"
temp = allTemp[main][0]
self.warningThresold = temp.high
self.dangerThresold = temp.critical
self.warningThresold = temp.high or 90.0
self.dangerThresold = temp.critical or 100.0
self.updateLevel(temp.current)
self.icon = Section.ramp(temp.current / temp.high, self.RAMP)