summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2009-10-24 13:27:02 +0200
committerMichael Stapelberg <michael@stapelberg.de>2009-10-24 13:27:02 +0200
commit013fdece8dbf31acf531b4745e335bb0edb56a2e (patch)
tree744fe406d455845a37fac9760af80e56f305436b /i3status.c
parent6cf90596649ecaea53d982ef2c02bf030117d33e (diff)
Change output format to be a config option instead of a compile time define
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/i3status.c b/i3status.c
index 67b86dd..c6e36f5 100644
--- a/i3status.c
+++ b/i3status.c
@@ -41,6 +41,7 @@ int main(int argc, char *argv[]) {
unsigned int j;
cfg_opt_t general_opts[] = {
+ CFG_STR("output_format", "dzen2", CFGF_NONE),
CFG_BOOL("colors", 1, CFGF_NONE),
CFG_INT("interval", 1, CFGF_NONE),
CFG_END()
@@ -137,6 +138,17 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
cfg_general = cfg_getsec(cfg, "general");
+ if (cfg_general == NULL)
+ die("Could not get section \"general\"\n");
+
+ char *output_str = cfg_getstr(cfg_general, "output_format");
+ if (strcasecmp(output_str, "dzen2") == 0)
+ output_format = O_DZEN2;
+ else if (strcasecmp(output_str, "xmobar") == 0)
+ output_format = O_XMOBAR;
+ else if (strcasecmp(output_str, "none") == 0)
+ output_format = O_NONE;
+ else die("Unknown output format: \"%s\"\n", output_str);
if ((general_socket = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
die("Could not create socket\n");