replace colors with urgency status + add means to hide unimportant measures; TODO: configurabilty of hiding
This commit is contained in:
parent
16706a5d5f
commit
68f268d7c2
7 changed files with 16 additions and 10 deletions
|
@ -13,6 +13,7 @@ class PluginThread(threading.Thread):
|
|||
if config.has_option(section, 'color'):
|
||||
self.status['color'] = config.get(section, 'color')
|
||||
self.freq = config.getint(section, 'freq', fallback=1)
|
||||
self.hide = False
|
||||
|
||||
def main(self):
|
||||
with open(BATTERY_DIR + 'capacity', 'r') as capacity, \
|
||||
|
@ -21,8 +22,11 @@ class PluginThread(threading.Thread):
|
|||
batt_capacity = capacity.read().strip()
|
||||
if batt_stat != 'Discharging':
|
||||
batt_stat = '\u2191'
|
||||
if float(batt_capacity) < 15:
|
||||
self.status['urgent'] = True
|
||||
else:
|
||||
batt_stat = '\u2193'
|
||||
|
||||
batt = 'BAT: ' + batt_capacity + '% ' + batt_stat
|
||||
|
||||
self.status['full_text'] = batt
|
||||
|
|
|
@ -11,6 +11,7 @@ class PluginThread(threading.Thread):
|
|||
if config.has_option(section, 'color'):
|
||||
self.status['color'] = config.get(section, 'color')
|
||||
self.freq = config.getint(section, 'freq', fallback=1)
|
||||
self.hide = False
|
||||
|
||||
def main(self):
|
||||
self.status['full_text'] = time.strftime(self.date_format)
|
||||
|
|
|
@ -12,6 +12,7 @@ class PluginThread(threading.Thread):
|
|||
if config.has_option(section, 'color'):
|
||||
self.status['color'] = config.get(section, 'color')
|
||||
self.freq = config.getint(section, 'freq', fallback=30)
|
||||
self.hide = False
|
||||
|
||||
def main(self):
|
||||
du_stat = psutil.disk_usage(self.part)
|
||||
|
|
|
@ -12,6 +12,7 @@ class PluginThread(threading.Thread):
|
|||
if config.has_option(section, 'color'):
|
||||
self.status['color'] = config.get(section, 'color')
|
||||
self.freq = config.getint(section, 'freq', fallback=10)
|
||||
self.hide = False
|
||||
|
||||
def main(self):
|
||||
loads = os.getloadavg()
|
||||
|
|
|
@ -11,6 +11,7 @@ class PluginThread(threading.Thread):
|
|||
if config.has_option(section, 'color'):
|
||||
self.status['color'] = config.get(section, 'color')
|
||||
self.freq = config.getint(section, 'freq', fallback=1)
|
||||
self.hide = False
|
||||
|
||||
def main(self):
|
||||
mem_stat = psutil.virtual_memory()
|
||||
|
|
|
@ -10,22 +10,19 @@ class PluginThread(threading.Thread):
|
|||
self.threadID = thread_id
|
||||
self.hosts = config.get(section, 'hosts').split(',')
|
||||
self.title = config.get(section, 'title')
|
||||
if config.has_option(section, 'colors'):
|
||||
self.colors = config.get(section, 'colors').split(',')
|
||||
else:
|
||||
self.colors = None
|
||||
self.timeout = config.get(section, 'timeout', fallback='150')
|
||||
self.status = dict()
|
||||
self.freq = config.getint(section, 'freq', fallback=5)
|
||||
self.format_status('n/a')
|
||||
self.hide = False
|
||||
|
||||
def format_status(self, state):
|
||||
self.status['full_text'] = self.title + ': ' + state
|
||||
if self.colors is not None:
|
||||
if state == 'on':
|
||||
self.status['color'] = self.colors[0]
|
||||
self.status['urgent'] = False
|
||||
self.hide = True
|
||||
else:
|
||||
self.status['color'] = self.colors[1]
|
||||
self.status['urgent'] = True
|
||||
|
||||
def main(self):
|
||||
random.shuffle(self.hosts)
|
||||
|
|
1
vdstatus
1
vdstatus
|
@ -70,6 +70,7 @@ def run_plugins(config_file=DEFAULT_CONFIG):
|
|||
while True:
|
||||
outputs = list()
|
||||
for plugin in plugins_l:
|
||||
if plugin.hide == False:
|
||||
outputs.append(plugin.status)
|
||||
print(format_outputs(outputs))
|
||||
time.sleep(1)
|
||||
|
|
Loading…
Reference in a new issue