load average as well

This commit is contained in:
Von Random 2016-10-31 15:20:07 +03:00
parent cc402b0e23
commit 9e971469b4

View file

@ -13,9 +13,16 @@ class PluginThread(threading.Thread):
self.status['color'] = config.get(section, 'color') self.status['color'] = config.get(section, 'color')
self.freq = config.getint(section, 'freq', fallback=10) self.freq = config.getint(section, 'freq', fallback=10)
self.hide = False self.hide = False
self.problem_value = config.getint(section, 'problem', fallback=100)
def main(self): def main(self):
loads = os.getloadavg() loads = os.getloadavg()
if loads[0] >= self.problem_value:
self.hide = False
self.status['urgent'] = True
else:
self.hide = True
self.status['urgent'] = False
loads = [str(i) for i in loads] loads = [str(i) for i in loads]
self.status['full_text'] = 'LA: ' + ' '.join(loads) self.status['full_text'] = 'LA: ' + ' '.join(loads)