summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorjohannes karoff <johannes@karoff.net>2016-01-31 19:16:42 +0100
committerjohannes karoff <johannes@karoff.net>2016-01-31 19:39:29 +0100
commit6f4819f7a5055e5e3bbfe5ff5b6447d6e300df17 (patch)
tree7fcce456c628987240b0f85f270d46fea76ac64a /include
parent85329802b29406925bf1f1656de85daf892309f3 (diff)
add separator and separator_block_width as universal module options
fixes #104
Diffstat (limited to 'include')
-rw-r--r--include/i3status.h60
1 files changed, 34 insertions, 26 deletions
diff --git a/include/i3status.h b/include/i3status.h
index a311d24..d6679ae 100644
--- a/include/i3status.h
+++ b/include/i3status.h
@@ -100,32 +100,40 @@ char *pct_mark;
} \
} while (0)
-#define SEC_CLOSE_MAP \
- do { \
- if (output_format == O_I3BAR) { \
- char *_align = cfg_getstr(sec, "align"); \
- if (_align) { \
- yajl_gen_string(json_gen, (const unsigned char *) "align", strlen("align")); \
- yajl_gen_string(json_gen, (const unsigned char *)_align, strlen(_align)); \
- } \
- struct min_width *_width = cfg_getptr(sec, "min_width"); \
- if (_width) { \
- /* if the value can be parsed as a number, we use the numerical value */ \
- if (_width->num > 0) { \
- yajl_gen_string(json_gen, (const unsigned char *) "min_width", strlen("min_width")); \
- yajl_gen_integer(json_gen, _width->num); \
- } else { \
- yajl_gen_string(json_gen, (const unsigned char *) "min_width", strlen("min_width")); \
- yajl_gen_string(json_gen, (const unsigned char *)_width->str, strlen(_width->str)); \
- } \
- } \
- const char *_sep = cfg_getstr(cfg_general, "separator"); \
- if (strlen(_sep) == 0) { \
- yajl_gen_string(json_gen, (const unsigned char *) "separator", strlen("separator")); \
- yajl_gen_bool(json_gen, false); \
- } \
- yajl_gen_map_close(json_gen); \
- } \
+#define SEC_CLOSE_MAP \
+ do { \
+ if (output_format == O_I3BAR) { \
+ char *_align = cfg_getstr(sec, "align"); \
+ if (_align) { \
+ yajl_gen_string(json_gen, (const unsigned char *) "align", strlen("align")); \
+ yajl_gen_string(json_gen, (const unsigned char *)_align, strlen(_align)); \
+ } \
+ struct min_width *_width = cfg_getptr(sec, "min_width"); \
+ if (_width) { \
+ /* if the value can be parsed as a number, we use the numerical value */ \
+ if (_width->num > 0) { \
+ yajl_gen_string(json_gen, (const unsigned char *) "min_width", strlen("min_width")); \
+ yajl_gen_integer(json_gen, _width->num); \
+ } else { \
+ yajl_gen_string(json_gen, (const unsigned char *) "min_width", strlen("min_width")); \
+ yajl_gen_string(json_gen, (const unsigned char *)_width->str, strlen(_width->str)); \
+ } \
+ } \
+ if (cfg_size(sec, "separator") > 0) { \
+ yajl_gen_string(json_gen, (const unsigned char *) "separator", strlen("separator")); \
+ yajl_gen_bool(json_gen, cfg_getbool(sec, "separator")); \
+ } \
+ if (cfg_size(sec, "separator_block_width") > 0) { \
+ yajl_gen_string(json_gen, (const unsigned char *) "separator_block_width", strlen("separator_block_width")); \
+ yajl_gen_integer(json_gen, cfg_getint(sec, "separator_block_width")); \
+ } \
+ const char *_sep = cfg_getstr(cfg_general, "separator"); \
+ if (strlen(_sep) == 0) { \
+ yajl_gen_string(json_gen, (const unsigned char *) "separator", strlen("separator")); \
+ yajl_gen_bool(json_gen, false); \
+ } \
+ yajl_gen_map_close(json_gen); \
+ } \
} while (0)
#define START_COLOR(colorstr) \