mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
bar: make location configurable (top or bottom)
This commit is contained in:
parent
7c468c20c0
commit
921cda0a81
3 changed files with 22 additions and 4 deletions
13
config.c
13
config.c
|
@ -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));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue