From 40a9291cefab006b03f38701324678251eb7d8c7 Mon Sep 17 00:00:00 2001 From: gacekjk Date: Sat, 21 Feb 2015 22:21:52 +0100 Subject: [PATCH] added alert temperature handling --- i3pystatus/temp.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/i3pystatus/temp.py b/i3pystatus/temp.py index 4639ccf..9e37ade 100644 --- a/i3pystatus/temp.py +++ b/i3pystatus/temp.py @@ -1,6 +1,3 @@ -import re -import glob - from i3pystatus import IntervalModule @@ -16,10 +13,14 @@ class Temperature(IntervalModule): "format string used for output. {temp} is the temperature in degrees celsius"), "color", "file", + "alert_temp", + "alert_color", ) format = "{temp} °C" color = "#FFFFFF" file = "/sys/class/thermal/thermal_zone0/temp" + alert_temp = 90 + alert_color = "#FF0000" def run(self): with open(self.file, "r") as f: @@ -27,5 +28,5 @@ class Temperature(IntervalModule): self.output = { "full_text": self.format.format(temp=temp), - "color": self.color, + "color": self.color if temp < self.alert_temp else self.alert_color, }