diff options
-rw-r--r-- | src/config_fs.c | 9 | ||||
-rw-r--r-- | src/config_node.c | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/config_fs.c b/src/config_fs.c index 45ccd46..aa61f4e 100644 --- a/src/config_fs.c +++ b/src/config_fs.c @@ -27,10 +27,14 @@ void config_fs_init(struct node* n) { void load_fs_key(struct node* n, char* key, char* val) { struct config_fs* data = (struct config_fs*) n->data; - if(strcmp(key, "path") == 0) + if(strcmp(key, "path") == 0) { strcpy(data->path, val); - else + // Provide a default label using the path if one not already specified + if(n->label[0] == '\0') + sprintf(n->label, "%s", val); + } else { printf("ERROR: Unknown fs key %s\n", key); + } } int config_fs_load(struct node* n) { @@ -58,6 +62,5 @@ int config_fs_load(struct node* n) { } else { sprintf(n->text, "%d%%", percent); } - sprintf(n->label, "%s:", ((struct config_fs*)n->data)->path); return 0; } diff --git a/src/config_node.c b/src/config_node.c index dcccc00..16aa0ed 100644 --- a/src/config_node.c +++ b/src/config_node.c @@ -66,7 +66,7 @@ void node_print(struct node* n) { printf("{ \"full_text\":\" %s\", \"color\": \"%s\", \"separator\":false },", n->label, n->label_color); - printf("{ \"full_text\":\" %s \", \"color\":\"%s\" }", n->text, n->color); + printf("{ \"full_text\":\"%s \", \"color\":\"%s\" }", n->text, n->color); if(n->next) printf(","); printf("\n"); |