From ce47d69174e3577d4f45f21ca36c27a8bf2cea02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Martano?= Date: Sat, 10 May 2014 10:35:54 -0300 Subject: [PATCH] configurable color and round parameters Allows to configure color parameter and round value. The last, for None->INT to work, needs more one change in utils.py that I will propose now too. --- i3pystatus/disk.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/i3pystatus/disk.py b/i3pystatus/disk.py index a4b7600..53bdd70 100644 --- a/i3pystatus/disk.py +++ b/i3pystatus/disk.py @@ -18,6 +18,8 @@ class Disk(IntervalModule): ("display_limit", "if more space is available than this limit the module is hidden"), ("critical_limit", "critical space limit (see critical_color)"), ("critical_color", "the critical color"), + ("color", "the common color"), + ("round_size", "precision, None for INT"), ) required = ("path",) color = "#FFFFFF" @@ -26,6 +28,8 @@ class Disk(IntervalModule): divisor = 1024 ** 3 display_limit = float('Inf') critical_limit = 0 + round_size = 2 + def run(self): stat = os.statvfs(self.path) @@ -44,7 +48,7 @@ class Disk(IntervalModule): "percentage_avail": stat.f_bavail / stat.f_blocks * 100, "percentage_used": (stat.f_blocks - stat.f_bfree) / stat.f_blocks * 100, } - round_dict(cdict, 2) + round_dict(cdict, self.round_size) self.output = { "full_text": self.format.format(**cdict),