diff options
author | Von Random <von@vdrandom.org> | 2016-10-25 19:48:40 +0300 |
---|---|---|
committer | Von Random <von@vdrandom.org> | 2016-10-25 19:48:40 +0300 |
commit | 68f268d7c2b27741175a2ccf82c032da27510292 (patch) | |
tree | 0f365acbabdfaa038a8e6aafdecb3b959143648f | |
parent | 16706a5d5f8d73491007242ac5132eea343846f5 (diff) |
replace colors with urgency status + add means to hide unimportant measures; TODO: configurabilty of hiding
-rw-r--r-- | plugins/batt.py | 4 | ||||
-rw-r--r-- | plugins/date.py | 1 | ||||
-rw-r--r-- | plugins/disk.py | 1 | ||||
-rw-r--r-- | plugins/load.py | 1 | ||||
-rw-r--r-- | plugins/mem.py | 1 | ||||
-rw-r--r-- | plugins/ping.py | 15 | ||||
-rwxr-xr-x | vdstatus | 3 |
7 files changed, 16 insertions, 10 deletions
diff --git a/plugins/batt.py b/plugins/batt.py index bd57fac..b9026f8 100644 --- a/plugins/batt.py +++ b/plugins/batt.py @@ -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 diff --git a/plugins/date.py b/plugins/date.py index 49a1bc6..cf022cb 100644 --- a/plugins/date.py +++ b/plugins/date.py @@ -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) diff --git a/plugins/disk.py b/plugins/disk.py index af6480e..0f508c0 100644 --- a/plugins/disk.py +++ b/plugins/disk.py @@ -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) diff --git a/plugins/load.py b/plugins/load.py index 4a9119c..5f19889 100644 --- a/plugins/load.py +++ b/plugins/load.py @@ -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() diff --git a/plugins/mem.py b/plugins/mem.py index a7e7e48..cf07abf 100644 --- a/plugins/mem.py +++ b/plugins/mem.py @@ -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() diff --git a/plugins/ping.py b/plugins/ping.py index 7a48caa..790c9f7 100644 --- a/plugins/ping.py +++ b/plugins/ping.py @@ -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] - else: - self.status['color'] = self.colors[1] + if state == 'on': + self.status['urgent'] = False + self.hide = True + else: + self.status['urgent'] = True def main(self): random.shuffle(self.hosts) @@ -70,7 +70,8 @@ def run_plugins(config_file=DEFAULT_CONFIG): while True: outputs = list() for plugin in plugins_l: - outputs.append(plugin.status) + if plugin.hide == False: + outputs.append(plugin.status) print(format_outputs(outputs)) time.sleep(1) |