summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVon Random <von@vdrandom.org>2016-10-31 15:10:30 +0300
committerVon Random <von@vdrandom.org>2016-10-31 15:10:30 +0300
commitcc402b0e23b9b78c4ea47f7a25638219e2a1aced (patch)
treed01fd207192dbb833bfb6f42e9748c738ec08fde
parent68f268d7c2b27741175a2ccf82c032da27510292 (diff)
disk check to auto hide as well
-rw-r--r--plugins/disk.py8
-rwxr-xr-xvdstatus10
2 files changed, 12 insertions, 6 deletions
diff --git a/plugins/disk.py b/plugins/disk.py
index 0f508c0..4f54241 100644
--- a/plugins/disk.py
+++ b/plugins/disk.py
@@ -13,10 +13,16 @@ class PluginThread(threading.Thread):
self.status['color'] = config.get(section, 'color')
self.freq = config.getint(section, 'freq', fallback=30)
self.hide = False
+ self.problem_value = config.getint(section, 'problem', fallback=70)
def main(self):
du_stat = psutil.disk_usage(self.part)
- # du_perc = str(du_stat.percent)
+ if du_stat.percent >= self.problem_value:
+ self.hide = False
+ self.status['urgent'] = True
+ else:
+ self.hide = True
+ self.status['urgent'] = False
du_free = str(round(du_stat.free / 2**30, 2))
du = self.part + ': ' + du_free + 'G'
self.status['full_text'] = du
diff --git a/vdstatus b/vdstatus
index 18abc9a..4be025f 100755
--- a/vdstatus
+++ b/vdstatus
@@ -1,8 +1,8 @@
#!/usr/bin/python3 -u
-# TODO:
-# * handle SIGINT properly
-# * add documentation / comments
-# * add a dummy plugin to use as a starting point
+# TODO: handle SIGINT properly
+# TODO: add documentation / comments
+# TODO: add a dummy plugin to use as a starting point
+# TODO: interactivity support
from sys import argv
import argparse
import configparser
@@ -70,7 +70,7 @@ def run_plugins(config_file=DEFAULT_CONFIG):
while True:
outputs = list()
for plugin in plugins_l:
- if plugin.hide == False:
+ if not plugin.hide:
outputs.append(plugin.status)
print(format_outputs(outputs))
time.sleep(1)