summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorPeter Bui <pnutzh4x0r@gmail.com>2011-02-26 17:45:12 -0500
committerMichael Stapelberg <michael@stapelberg.de>2011-05-06 13:13:11 +0200
commit8b18e8e33cbefc19f7f011a7ac83820621395b2f (patch)
tree0b7c363218fecae57496b17e572341ab98129dc7 /i3status.c
parent0a13d304654a63c53f9cffdcd8941b92f3a445fe (diff)
Add print_cpu_usage
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/i3status.c b/i3status.c
index 779e27f..542d270 100644
--- a/i3status.c
+++ b/i3status.c
@@ -226,6 +226,11 @@ int main(int argc, char *argv[]) {
CFG_STR("format", "%5min %10min %15min", CFGF_NONE),
CFG_END()
};
+
+ cfg_opt_t usage_opts[] = {
+ CFG_STR("format", "%usage", CFGF_NONE),
+ CFG_END()
+ };
cfg_opt_t temp_opts[] = {
CFG_STR("format", "%degrees C", CFGF_NONE),
@@ -260,6 +265,7 @@ int main(int argc, char *argv[]) {
CFG_SEC("time", time_opts, CFGF_NONE),
CFG_SEC("ddate", ddate_opts, CFGF_NONE),
CFG_SEC("load", load_opts, CFGF_NONE),
+ CFG_SEC("cpu_usage", usage_opts, CFGF_NONE),
CFG_END()
};
@@ -370,6 +376,9 @@ int main(int argc, char *argv[]) {
CASE_SEC_TITLE("cpu_temperature")
print_cpu_temperature_info(atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"));
+
+ CASE_SEC("cpu_usage")
+ print_cpu_usage(cfg_getstr(sec, "format"));
}
printf("\n");
fflush(stdout);