diff options
author | Kenneth Lyons <ixjlyons@gmail.com> | 2015-10-05 01:10:01 -0700 |
---|---|---|
committer | Kenneth Lyons <ixjlyons@gmail.com> | 2015-12-04 10:27:18 -0800 |
commit | dcd0518e25d7aa84a720780cb70b3f8fca867972 (patch) | |
tree | be4adabae8ccab52113198b7b01b7a17fee0244c /i3status.c | |
parent | 876c1cef8d182ae1898368b415cf67dede279036 (diff) |
Added support for Pango markup.
Diffstat (limited to 'i3status.c')
-rw-r--r-- | i3status.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -295,6 +295,7 @@ int main(int argc, char *argv[]) { CFG_STR("color_separator", "#333333", CFGF_NONE), CFG_INT("interval", 1, CFGF_NONE), CFG_COLOR_OPTS("#00FF00", "#FFFF00", "#FF0000"), + CFG_STR("markup", "none", CFGF_NONE), CFG_END()}; cfg_opt_t run_watch_opts[] = { @@ -365,6 +366,7 @@ int main(int argc, char *argv[]) { cfg_opt_t tztime_opts[] = { CFG_STR("format", "%Y-%m-%d %H:%M:%S %Z", CFGF_NONE), CFG_STR("timezone", "", CFGF_NONE), + CFG_STR("format_time", NULL, CFGF_NONE), CFG_CUSTOM_ALIGN_OPT, CFG_CUSTOM_MIN_WIDTH_OPT, CFG_END()}; @@ -532,6 +534,14 @@ int main(int argc, char *argv[]) { if (!valid_color(cfg_getstr(cfg_general, "color_good")) || !valid_color(cfg_getstr(cfg_general, "color_degraded")) || !valid_color(cfg_getstr(cfg_general, "color_bad")) || !valid_color(cfg_getstr(cfg_general, "color_separator"))) die("Bad color format"); + char *markup_str = cfg_getstr(cfg_general, "markup"); + if (strcasecmp(markup_str, "pango") == 0) + markup_format = M_PANGO; + else if (strcasecmp(markup_str, "none") == 0) + markup_format = M_NONE; + else + die("Unknown markup format: \"%s\"\n", markup_str); + #if YAJL_MAJOR >= 2 yajl_gen json_gen = yajl_gen_alloc(NULL); #else @@ -648,13 +658,13 @@ int main(int argc, char *argv[]) { CASE_SEC("time") { SEC_OPEN_MAP("time"); - print_time(json_gen, buffer, NULL, cfg_getstr(sec, "format"), NULL, tv.tv_sec); + print_time(json_gen, buffer, NULL, cfg_getstr(sec, "format"), NULL, NULL, tv.tv_sec); SEC_CLOSE_MAP; } CASE_SEC_TITLE("tztime") { SEC_OPEN_MAP("tztime"); - print_time(json_gen, buffer, title, cfg_getstr(sec, "format"), cfg_getstr(sec, "timezone"), tv.tv_sec); + print_time(json_gen, buffer, title, cfg_getstr(sec, "format"), cfg_getstr(sec, "timezone"), cfg_getstr(sec, "format_time"), tv.tv_sec); SEC_CLOSE_MAP; } |