mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-19 01:05:39 +02:00
Fixes for size setting and config
+ height is optional + width is optional + make location enum into bitmask
This commit is contained in:
parent
033f21a1f2
commit
37b5b02fc4
6 changed files with 51 additions and 74 deletions
13
config.c
13
config.c
|
@ -289,11 +289,14 @@ conf_to_bar(const struct yml_node *bar, enum bar_backend backend)
|
|||
/*
|
||||
* Required attributes
|
||||
*/
|
||||
|
||||
const struct yml_node *location = yml_get_value(bar, "location");
|
||||
conf.location = strcmp(yml_value_as_string(location), "top") == 0
|
||||
? BAR_TOP : BAR_BOTTOM;
|
||||
|
||||
const char *location_str = yml_value_as_string(location);
|
||||
conf.location = strcmp(location_str, "top") == 0
|
||||
? BAR_TOP
|
||||
: strcmp(location_str, "left") == 0
|
||||
? BAR_LEFT
|
||||
: strcmp(location_str, "right") == 0
|
||||
? BAR_RIGHT : BAR_BOTTOM;
|
||||
const struct yml_node *background = yml_get_value(bar, "background");
|
||||
conf.background = conf_to_color(background);
|
||||
|
||||
|
@ -309,7 +312,7 @@ conf_to_bar(const struct yml_node *bar, enum bar_backend backend)
|
|||
|
||||
const struct yml_node *width = yml_get_value(bar, "width");
|
||||
if (width != NULL)
|
||||
conf.width = yml_value_as_int(height);
|
||||
conf.width = yml_value_as_int(width);
|
||||
else
|
||||
conf.width = -1; // Represents 'auto' width
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue