dotfiles/.config/i3/py3status/gpu_temp.py
2019-10-30 20:41:58 +02:00

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)
}