29 lines
629 B
Python
29 lines
629 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
"""
|
||
|
This module produces GPU temperature
|
||
|
|
||
|
"""
|
||
|
import sys
|
||
|
sys.path.insert(1, '/home/lanxu/Scripts/')
|
||
|
from gputemp import get_temperature
|
||
|
|
||
|
class Py3status:
|
||
|
format = 'GPU: {temp}℃'
|
||
|
thresholds = [
|
||
|
(0, "good"),
|
||
|
(45, "degraded"),
|
||
|
(60, "bad")
|
||
|
]
|
||
|
|
||
|
def gpu_temp(self):
|
||
|
temp = float(get_temperature())
|
||
|
|
||
|
full_text = self.py3.safe_format(self.format, { 'temp': temp})
|
||
|
color = self.py3.threshold_get_color(temp)
|
||
|
|
||
|
return {
|
||
|
'full_text': full_text,
|
||
|
'color': color,
|
||
|
'cached_until': self.py3.time_in(15)
|
||
|
}
|