From 7b021d3eb20c9bf63ad8fa54ae253add47e551f6 Mon Sep 17 00:00:00 2001 From: Marco Hunsicker Date: Sat, 1 Mar 2014 09:55:29 +0100 Subject: i3status: Allow customization of module separator This patch adds the ability to customize the separator that is placed between modules. Specifically this patch: * adds the "separator" general directive * moves the definition of the default separator for the different output formats (excluding color formatting) to src/i3status.c * updates the SEC_CLOSE_MAP macro to disable the separator for the i3bar output format if the separator directive dictates so * changes print_seperator() in src/output.c to take a separator parameter in order to disable the output of the separator if the separator is empty and to use the provided separator otherwise * updates the manpage to explain the new directive --- include/i3status.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/i3status.h b/include/i3status.h index e1246b9..a6cd535 100644 --- a/include/i3status.h +++ b/include/i3status.h @@ -88,6 +88,11 @@ enum { O_DZEN2, O_XMOBAR, O_I3BAR, O_TERM, O_NONE } output_format; #define SEC_CLOSE_MAP \ do { \ if (output_format == O_I3BAR) { \ + 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) @@ -133,7 +138,7 @@ void die(const char *fmt, ...); bool slurp(const char *filename, char *destination, int size); /* src/output.c */ -void print_seperator(); +void print_seperator(const char *separator); char *color(const char *colorstr); char *endcolor() __attribute__ ((pure)); void reset_cursor(void); -- cgit v1.2.3