mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 03:35:41 +02:00
config: i3: handle the 'spacing' attribute
This commit is contained in:
parent
500aebe9ef
commit
c795718ad7
1 changed files with 9 additions and 4 deletions
13
config.c
13
config.c
|
@ -416,13 +416,20 @@ static struct module *
|
||||||
module_i3_from_config(const struct yml_node *node, const struct font *parent_font)
|
module_i3_from_config(const struct yml_node *node, const struct font *parent_font)
|
||||||
{
|
{
|
||||||
const struct yml_node *c = yml_get_value(node, "content");
|
const struct yml_node *c = yml_get_value(node, "content");
|
||||||
|
const struct yml_node *spacing = yml_get_value(node, "spacing");
|
||||||
const struct yml_node *left_spacing = yml_get_value(node, "left_spacing");
|
const struct yml_node *left_spacing = yml_get_value(node, "left_spacing");
|
||||||
const struct yml_node *right_spacing = yml_get_value(node, "right_spacing");
|
const struct yml_node *right_spacing = yml_get_value(node, "right_spacing");
|
||||||
|
|
||||||
assert(yml_is_dict(c));
|
assert(yml_is_dict(c));
|
||||||
|
assert(spacing == NULL || yml_is_scalar(spacing));
|
||||||
assert(left_spacing == NULL || yml_is_scalar(left_spacing));
|
assert(left_spacing == NULL || yml_is_scalar(left_spacing));
|
||||||
assert(right_spacing == NULL || yml_is_scalar(right_spacing));
|
assert(right_spacing == NULL || yml_is_scalar(right_spacing));
|
||||||
|
|
||||||
|
int left = spacing != NULL ? yml_value_as_int(spacing) :
|
||||||
|
left_spacing != NULL ? yml_value_as_int(left_spacing) : 0;
|
||||||
|
int right = spacing != NULL ? yml_value_as_int(spacing) :
|
||||||
|
right_spacing != NULL ? yml_value_as_int(right_spacing) : 0;
|
||||||
|
|
||||||
struct i3_workspaces workspaces[yml_dict_length(c)];
|
struct i3_workspaces workspaces[yml_dict_length(c)];
|
||||||
|
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
|
@ -430,14 +437,12 @@ module_i3_from_config(const struct yml_node *node, const struct font *parent_fon
|
||||||
it.key != NULL;
|
it.key != NULL;
|
||||||
yml_dict_next(&it), idx++)
|
yml_dict_next(&it), idx++)
|
||||||
{
|
{
|
||||||
|
assert(yml_is_scalar(it.key));
|
||||||
workspaces[idx].name = yml_value_as_string(it.key);
|
workspaces[idx].name = yml_value_as_string(it.key);
|
||||||
workspaces[idx].content = particle_from_config(it.value, parent_font);
|
workspaces[idx].content = particle_from_config(it.value, parent_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
return module_i3(
|
return module_i3(workspaces, yml_dict_length(c), left, right);
|
||||||
workspaces, yml_dict_length(c),
|
|
||||||
left_spacing != NULL ? yml_value_as_int(left_spacing) : 0,
|
|
||||||
right_spacing != NULL ? yml_value_as_int(right_spacing) : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct module *
|
static struct module *
|
||||||
|
|
Loading…
Add table
Reference in a new issue