diff options
author | Marcelo Cerri <mhcerri@gmail.com> | 2012-10-18 17:55:41 -0300 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2012-10-24 18:59:46 +0200 |
commit | dbf3adc81d189c284d24b0e8debf387ba23ccc40 (patch) | |
tree | a3b0587a8e8fc241b618a6ecb1a5fcec64992e6b /i3status.c | |
parent | e10d38fea0956b01064f694bca3e827ba3f3e261 (diff) |
add good, degraded and bad colors per module
This commit adds support for color_good, color_degraded and color_bad
directives per module section in the config file.
Diffstat (limited to 'i3status.c')
-rw-r--r-- | i3status.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -35,10 +35,17 @@ #define exit_if_null(pointer, ...) { if (pointer == NULL) die(__VA_ARGS__); } +#define CFG_COLOR_OPTS(good, degraded, bad) \ + CFG_STR("color_good", good, CFGF_NONE), \ + CFG_STR("color_degraded", degraded, CFGF_NONE), \ + CFG_STR("color_bad", bad, CFGF_NONE) + +#define CFG_CUSTOM_COLOR_OPTS CFG_COLOR_OPTS(NULL, NULL, NULL) + /* socket file descriptor for general purposes */ int general_socket; -cfg_t *cfg, *cfg_general; +cfg_t *cfg, *cfg_general, *cfg_section; /* * Exit upon SIGPIPE because when we have nowhere to write to, gathering @@ -179,35 +186,37 @@ int main(int argc, char *argv[]) { cfg_opt_t general_opts[] = { 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), - CFG_STR("color_bad", "#FF0000", CFGF_NONE), CFG_STR("color_separator", "#333333", CFGF_NONE), CFG_INT("interval", 1, CFGF_NONE), + CFG_COLOR_OPTS("#00FF00", "#FFFF00", "#FF0000"), CFG_END() }; cfg_opt_t run_watch_opts[] = { CFG_STR("pidfile", NULL, CFGF_NONE), CFG_STR("format", "%title: %status", CFGF_NONE), + CFG_CUSTOM_COLOR_OPTS, CFG_END() }; cfg_opt_t wireless_opts[] = { CFG_STR("format_up", "W: (%quality at %essid, %bitrate) %ip", CFGF_NONE), CFG_STR("format_down", "W: down", CFGF_NONE), + CFG_CUSTOM_COLOR_OPTS, CFG_END() }; cfg_opt_t ethernet_opts[] = { CFG_STR("format_up", "E: %ip (%speed)", CFGF_NONE), CFG_STR("format_down", "E: down", CFGF_NONE), + CFG_CUSTOM_COLOR_OPTS, CFG_END() }; cfg_opt_t ipv6_opts[] = { CFG_STR("format_up", "%ip", CFGF_NONE), CFG_STR("format_down", "no IPv6", CFGF_NONE), + CFG_CUSTOM_COLOR_OPTS, CFG_END() }; @@ -257,6 +266,7 @@ int main(int argc, char *argv[]) { CFG_STR("device", "default", CFGF_NONE), CFG_STR("mixer", "Master", CFGF_NONE), CFG_INT("mixer_idx", 0, CFGF_NONE), + CFG_CUSTOM_COLOR_OPTS, CFG_END() }; @@ -275,6 +285,7 @@ int main(int argc, char *argv[]) { CFG_SEC("ddate", ddate_opts, CFGF_NONE), CFG_SEC("load", load_opts, CFGF_NONE), CFG_SEC("cpu_usage", usage_opts, CFGF_NONE), + CFG_CUSTOM_COLOR_OPTS, CFG_END() }; |