bar: make location configurable (top or bottom)

This commit is contained in:
Daniel Eklöf 2018-11-17 11:54:14 +01:00
parent 7c468c20c0
commit 921cda0a81
3 changed files with 22 additions and 4 deletions

View file

@ -198,6 +198,7 @@ conf_to_bar(const struct yml_node *bar)
struct font *font = font_new("sans", 12, false, false, 0);
const struct yml_node *height = yml_get_value(bar, "height");
const struct yml_node *location = yml_get_value(bar, "location");
const struct yml_node *background = yml_get_value(bar, "background");
const struct yml_node *spacing = yml_get_value(bar, "spacing");
const struct yml_node *left_spacing = yml_get_value(bar, "left_spacing");
@ -214,6 +215,18 @@ conf_to_bar(const struct yml_node *bar)
if (height != NULL)
conf.height = yml_value_as_int(height);
if (location != NULL) {
const char *loc = yml_value_as_string(location);
assert(strcasecmp(loc, "top") == 0 || strcasecmp(loc, "bottom") == 0);
if (strcasecmp(loc, "top") == 0)
conf.location = BAR_TOP;
else if (strcasecmp(loc, "bottom") == 0)
conf.location = BAR_BOTTOM;
else
assert(false);
}
if (background != NULL)
conf.background = color_from_hexstr(yml_value_as_string(background));