added alert temperature handling
This commit is contained in:
parent
0e7e04f075
commit
40a9291cef
@ -1,6 +1,3 @@
|
|||||||
import re
|
|
||||||
import glob
|
|
||||||
|
|
||||||
from i3pystatus import IntervalModule
|
from i3pystatus import IntervalModule
|
||||||
|
|
||||||
|
|
||||||
@ -16,10 +13,14 @@ class Temperature(IntervalModule):
|
|||||||
"format string used for output. {temp} is the temperature in degrees celsius"),
|
"format string used for output. {temp} is the temperature in degrees celsius"),
|
||||||
"color",
|
"color",
|
||||||
"file",
|
"file",
|
||||||
|
"alert_temp",
|
||||||
|
"alert_color",
|
||||||
)
|
)
|
||||||
format = "{temp} °C"
|
format = "{temp} °C"
|
||||||
color = "#FFFFFF"
|
color = "#FFFFFF"
|
||||||
file = "/sys/class/thermal/thermal_zone0/temp"
|
file = "/sys/class/thermal/thermal_zone0/temp"
|
||||||
|
alert_temp = 90
|
||||||
|
alert_color = "#FF0000"
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
with open(self.file, "r") as f:
|
with open(self.file, "r") as f:
|
||||||
@ -27,5 +28,5 @@ class Temperature(IntervalModule):
|
|||||||
|
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(temp=temp),
|
"full_text": self.format.format(temp=temp),
|
||||||
"color": self.color,
|
"color": self.color if temp < self.alert_temp else self.alert_color,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user