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 --- src/output.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/output.c b/src/output.c index 4473ca5..e56c892 100644 --- a/src/output.c +++ b/src/output.c @@ -52,15 +52,18 @@ char *endcolor(void) { else return ""; } -void print_seperator(void) { +void print_seperator(const char *separator) { + if (output_format == O_I3BAR || strlen(separator) == 0) + return; + if (output_format == O_DZEN2) - printf("^fg(%s)^p(5;-2)^ro(2)^p()^fg()^p(5)", cfg_getstr(cfg_general, "color_separator")); + printf("^fg(%s)%s^fg()", cfg_getstr(cfg_general, "color_separator"), separator); else if (output_format == O_XMOBAR) - printf(" | ", cfg_getstr(cfg_general, "color_separator")); + printf("%s", cfg_getstr(cfg_general, "color_separator"), separator); else if (output_format == O_TERM) - printf(" %s|%s ", color("color_separator"), endcolor()); + printf("%s%s%s", color("color_separator"), separator, endcolor()); else if (output_format == O_NONE) - printf(" | "); + printf("%s", separator); } /* -- cgit v1.2.3