i3bar: spit out an error on wrong bar id

This commit is contained in:
Michael Stapelberg 2011-10-21 20:04:55 +01:00
parent a3b7ba15ed
commit 6de1590e59
1 changed files with 17 additions and 1 deletions

View File

@ -42,6 +42,22 @@ static int config_map_key_cb(void *params_, const unsigned char *keyVal, unsigne
return 1; return 1;
} }
/*
* Parse a null-value (current_workspace)
*
*/
static int config_null_cb(void *params_) {
if (!strcmp(cur_key, "id")) {
/* If 'id' is NULL, the bar config was not found. Error out. */
ELOG("No such bar config. Use 'i3-msg -t get_bar_config' to get the available configs.\n");
ELOG("Are you starting i3bar by hand? You should not:\n");
ELOG("Configure a 'bar' block in your i3 config and i3 will launch i3bar automatically.\n");
exit(EXIT_FAILURE);
}
return 1;
}
/* /*
* Parse a string * Parse a string
* *
@ -143,7 +159,7 @@ static int config_boolean_cb(void *params_, int val) {
/* A datastructure to pass all these callbacks to yajl */ /* A datastructure to pass all these callbacks to yajl */
static yajl_callbacks outputs_callbacks = { static yajl_callbacks outputs_callbacks = {
NULL, &config_null_cb,
&config_boolean_cb, &config_boolean_cb,
NULL, NULL,
NULL, NULL,