i3 - improved tiling WM


allow load to be a float

Patch status: merged

Patch by M. Kory Woods

To apply this patch, use:
curl http://cr.i3wm.org/patch/187/raw.patch | git am

b/i3status.c

15
@@ -261,7 +261,7 @@ int main(int argc, char *argv[]) {
16
 
17
         cfg_opt_t load_opts[] = {
18
                 CFG_STR("format", "%1min %5min %15min", CFGF_NONE),
19
-                CFG_INT("max_threshold", 5, CFGF_NONE),
20
+                CFG_FLOAT("max_threshold", 5, CFGF_NONE),
21
                 CFG_CUSTOM_COLOR_OPTS,
22
                 CFG_END()
23
         };
24
@@ -488,7 +488,7 @@ int main(int argc, char *argv[]) {
25
 
26
                         CASE_SEC("load") {
27
                                 SEC_OPEN_MAP("load");
28
-                                print_load(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getint(sec, "max_threshold"));
29
+                                print_load(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getfloat(sec, "max_threshold"));
30
                                 SEC_CLOSE_MAP;
31
                         }
32
 

b/include/i3status.h

37
@@ -152,7 +152,7 @@ void print_run_watch(yajl_gen json_gen, char *buffer, const char *title, const c
38
 void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format, int);
39
 void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format);
40
 void print_eth_info(yajl_gen json_gen, char *buffer, const char *interface, const char *format_up, const char *format_down);
41
-void print_load(yajl_gen json_gen, char *buffer, const char *format, const int max_threshold);
42
+void print_load(yajl_gen json_gen, char *buffer, const char *format, const float max_threshold);
43
 void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *device, const char *mixer, int mixer_idx);
44
 bool process_runs(const char *path);
45
 

b/src/print_load.c

50
@@ -6,7 +6,7 @@
51
 #include <yajl/yajl_gen.h>
52
 #include <yajl/yajl_version.h>
53
 
54
-void print_load(yajl_gen json_gen, char *buffer, const char *format, const int max_threshold) {
55
+void print_load(yajl_gen json_gen, char *buffer, const char *format, const float max_threshold) {
56
         char *outwalk = buffer;
57
         /* Get load */
58