diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2011-07-13 03:27:57 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2011-07-13 03:27:57 +0200 |
commit | 7ab9167536e4ca0ccb5c5a797e693c484e0456d6 (patch) | |
tree | 26a60cb557cb4719dc429e3c157dd8790fa76451 /i3status.c | |
parent | a46984d06ccc234d07ced0bda80fa8d6f3f21076 (diff) |
magic: try to auto-detect output_format by default (dzen2/i3bar/xmobar)
Diffstat (limited to 'i3status.c')
-rw-r--r-- | i3status.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -173,7 +173,7 @@ int main(int argc, char *argv[]) { unsigned int j; cfg_opt_t general_opts[] = { - CFG_STR("output_format", "dzen2", CFGF_NONE), + CFG_STR("output_format", "auto", CFGF_NONE), CFG_BOOL("colors", 1, CFGF_NONE), CFG_STR("color_good", "#00FF00", CFGF_NONE), CFG_STR("color_degraded", "#FFFF00", CFGF_NONE), @@ -312,6 +312,17 @@ int main(int argc, char *argv[]) { die("Could not get section \"general\"\n"); char *output_str = cfg_getstr(cfg_general, "output_format"); + if (strcasecmp(output_str, "auto") == 0) { + fprintf(stderr, "i3status: trying to auto-detect output_format setting\n"); + output_str = auto_detect_format(); + if (!output_str) { + output_str = "none"; + fprintf(stderr, "i3status: falling back to \"none\"\n"); + } else { + fprintf(stderr, "i3status: auto-detected \"%s\"\n", output_str); + } + } + if (strcasecmp(output_str, "dzen2") == 0) output_format = O_DZEN2; else if (strcasecmp(output_str, "xmobar") == 0) |