dotfiles/config/i3/py3status/gpu_temp.py

29 lines
629 B
Python
Raw Normal View History

2022-08-30 22:24:49 +03:00
# -*- 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"),
(50, "degraded"),
(70, "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)
}