summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorMats <d912e3@gmail.com>2014-03-08 00:24:42 +0100
committerMichael Stapelberg <michael@stapelberg.de>2014-03-09 22:57:19 +0100
commitbc0bd8c9e03d92ab133f4dfae52dc202c3e0cbf6 (patch)
tree61eebe406b1a1978d1fb3d1e84706ab2daaba48e /i3status.c
parent1de12e7b20e7ce38e2777218f1d922b3255599e1 (diff)
disk: Colorize output when below given threshold
New disk module options: * threshold_type: ^(percentage|[kmgt]?bytes)_(free|avail)$ * low_threshold: <double> fixes #912
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/i3status.c b/i3status.c
index 3733cf0..1811884 100644
--- a/i3status.c
+++ b/i3status.c
@@ -382,7 +382,10 @@ int main(int argc, char *argv[]) {
cfg_opt_t disk_opts[] = {
CFG_STR("format", "%free", CFGF_NONE),
CFG_STR("prefix_type", "binary", CFGF_NONE),
+ CFG_STR("threshold_type", "percentage_avail", CFGF_NONE),
+ CFG_FLOAT("low_threshold", 0, CFGF_NONE),
CFG_CUSTOM_ALIGN_OPT,
+ CFG_CUSTOM_COLOR_OPTS,
CFG_CUSTOM_MIN_WIDTH_OPT,
CFG_END()
};
@@ -601,7 +604,7 @@ int main(int argc, char *argv[]) {
CASE_SEC_TITLE("disk") {
SEC_OPEN_MAP("disk_info");
- print_disk_info(json_gen, buffer, title, cfg_getstr(sec, "format"), cfg_getstr(sec, "prefix_type"));
+ print_disk_info(json_gen, buffer, title, cfg_getstr(sec, "format"), cfg_getstr(sec, "prefix_type"), cfg_getstr(sec, "threshold_type"), cfg_getfloat(sec, "low_threshold"));
SEC_CLOSE_MAP;
}