diff options
author | Ingo Bürk <admin@airblader.de> | 2018-05-19 22:08:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-19 22:08:42 +0200 |
commit | b850f5852d0e455c246827a603ac28577a70428d (patch) | |
tree | 81530fd72f1d81d80e4d960d9009a857e55a59a6 /i3status.c | |
parent | ffe41cc9440d0404101dae9420f91d2e0cdf3468 (diff) | |
parent | cba8f559384008f187e7388186b9885343be0678 (diff) |
Merge pull request #270 from Stunkymonkey/mem-support
initial support of memory-usage for linux
Diffstat (limited to 'i3status.c')
-rw-r--r-- | i3status.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -421,6 +421,19 @@ int main(int argc, char *argv[]) { CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT, CFG_END()}; + cfg_opt_t memory_opts[] = { + CFG_STR("format", "%used %free %available", CFGF_NONE), + CFG_STR("format_degraded", NULL, CFGF_NONE), + CFG_STR("threshold_degraded", NULL, CFGF_NONE), + CFG_STR("threshold_critical", NULL, CFGF_NONE), + CFG_STR("memory_used_method", "classical", CFGF_NONE), + CFG_CUSTOM_ALIGN_OPT, + CFG_CUSTOM_COLOR_OPTS, + CFG_CUSTOM_MIN_WIDTH_OPT, + CFG_CUSTOM_SEPARATOR_OPT, + CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT, + CFG_END()}; + cfg_opt_t usage_opts[] = { CFG_STR("format", "%usage", CFGF_NONE), CFG_STR("format_above_threshold", NULL, CFGF_NONE), @@ -490,6 +503,7 @@ int main(int argc, char *argv[]) { CFG_SEC("tztime", tztime_opts, CFGF_TITLE | CFGF_MULTI), CFG_SEC("ddate", ddate_opts, CFGF_NONE), CFG_SEC("load", load_opts, CFGF_NONE), + CFG_SEC("memory", memory_opts, CFGF_NONE), CFG_SEC("cpu_usage", usage_opts, CFGF_NONE), CFG_END()}; @@ -724,6 +738,12 @@ int main(int argc, char *argv[]) { SEC_CLOSE_MAP; } + CASE_SEC("memory") { + SEC_OPEN_MAP("memory"); + print_memory(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getstr(sec, "format_degraded"), cfg_getstr(sec, "threshold_degraded"), cfg_getstr(sec, "threshold_critical"), cfg_getstr(sec, "memory_used_method")); + SEC_CLOSE_MAP; + } + CASE_SEC("time") { SEC_OPEN_MAP("time"); print_time(json_gen, buffer, NULL, cfg_getstr(sec, "format"), NULL, NULL, NULL, tv.tv_sec); |