mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-24 21:05:40 +02:00
config: battery: use name from config, instead of hardcoded "BAT0"
This commit is contained in:
parent
ef594b877b
commit
e0bd7abec6
1 changed files with 4 additions and 1 deletions
5
config.c
5
config.c
|
@ -306,13 +306,16 @@ module_battery_from_config(const struct yml_node *node,
|
||||||
const struct font *parent_font)
|
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 *name = yml_get_value(node, "name");
|
||||||
const struct yml_node *poll_interval = yml_get_value(node, "poll_interval");
|
const struct yml_node *poll_interval = yml_get_value(node, "poll_interval");
|
||||||
|
|
||||||
assert(yml_is_dict(c));
|
assert(yml_is_dict(c));
|
||||||
|
assert(yml_is_scalar(name));
|
||||||
assert(poll_interval == NULL || yml_is_scalar(poll_interval));
|
assert(poll_interval == NULL || yml_is_scalar(poll_interval));
|
||||||
|
|
||||||
return module_battery(
|
return module_battery(
|
||||||
"BAT0", particle_from_config(c, parent_font),
|
yml_value_as_string(name),
|
||||||
|
particle_from_config(c, parent_font),
|
||||||
poll_interval != NULL ? yml_value_as_int(poll_interval) : 30);
|
poll_interval != NULL ? yml_value_as_int(poll_interval) : 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue