summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Hunsicker <i3@hunsicker.de>2014-03-01 09:55:29 +0100
committerMichael Stapelberg <michael@stapelberg.de>2014-03-01 10:21:11 +0100
commit7b021d3eb20c9bf63ad8fa54ae253add47e551f6 (patch)
tree41e2dec68b86a792082ad6c1ad256627abd73c4a /src
parent26faed4c2f2c23f17b0c9170a4a72bb018931ed8 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/output.c13
1 files changed, 8 insertions, 5 deletions
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("<fc=%s> | </fc>", cfg_getstr(cfg_general, "color_separator"));
+ printf("<fc=%s>%s</fc>", 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);
}
/*