* vim:ts=4:sw=4:expandtab
*
* i3bar - an xcb-based status- and ws-bar for i3
- * © 2010-2011 Axel Wagner and contributors (see also: LICENSE)
+ * © 2010 Axel Wagner and contributors (see also: LICENSE)
*
* config.c: Parses the configuration (received from i3).
*
}
/*
- * Parse a null-value (current_workspace)
+ * Parse a null value (current_workspace)
*
*/
static int config_null_cb(void *params_) {
return 1;
}
+ if (!strcmp(cur_key, "wheel_up_cmd")) {
+ DLOG("wheel_up_cmd = %.*s\n", len, val);
+ FREE(config.wheel_up_cmd);
+ sasprintf(&config.wheel_up_cmd, "%.*s", len, val);
+ return 1;
+ }
+
+ if (!strcmp(cur_key, "wheel_down_cmd")) {
+ DLOG("wheel_down_cmd = %.*s\n", len, val);
+ FREE(config.wheel_down_cmd);
+ sasprintf(&config.wheel_down_cmd, "%.*s", len, val);
+ return 1;
+ }
+
if (!strcmp(cur_key, "position")) {
DLOG("position = %.*s\n", len, val);
config.position = (len == 3 && !strncmp((const char *)val, "top", strlen("top")) ? POS_TOP : POS_BOT);
return 1;
}
+ if (!strcmp(cur_key, "separator_symbol")) {
+ DLOG("separator = %.*s\n", len, val);
+ I3STRING_FREE(config.separator_symbol);
+ config.separator_symbol = i3string_from_utf8_with_length((const char *)val, len);
+ return 1;
+ }
+
if (!strcmp(cur_key, "outputs")) {
DLOG("+output %.*s\n", len, val);
int new_num_outputs = config.num_outputs + 1;
};
/*
- * Start parsing the received bar configuration json-string
+ * Start parsing the received bar configuration JSON string
*
*/
void parse_config_json(char *json) {
state = yajl_parse(handle, (const unsigned char *)json, strlen(json));
- /* FIXME: Proper errorhandling for JSON-parsing */
+ /* FIXME: Proper error handling for JSON parsing */
switch (state) {
case yajl_status_ok:
break;
case yajl_status_client_canceled:
case yajl_status_error:
- ELOG("Could not parse config-reply!\n");
+ ELOG("Could not parse config reply!\n");
exit(EXIT_FAILURE);
break;
}
*
*/
void free_colors(struct xcb_color_strings_t *colors) {
-#define FREE_COLOR(x) \
- do { \
- FREE(colors->x); \
+#define FREE_COLOR(x) \
+ do { \
+ FREE(colors->x); \
} while (0)
FREE_COLOR(bar_fg);
FREE_COLOR(bar_bg);