mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
module/clock: user can now specify the date/time format strings
This commit is contained in:
parent
9037aadd04
commit
7fc9749c28
4 changed files with 33 additions and 8 deletions
11
config.c
11
config.c
|
@ -423,8 +423,17 @@ static struct module *
|
|||
module_clock_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 *date_format = yml_get_value(node, "date-format");
|
||||
const struct yml_node *time_format = yml_get_value(node, "time-format");
|
||||
|
||||
assert(c != NULL);
|
||||
return module_clock(particle_from_config(c, parent_font));
|
||||
assert(date_format == NULL || yml_is_scalar(date_format));
|
||||
assert(time_format == NULL || yml_is_scalar(time_format));
|
||||
|
||||
return module_clock(
|
||||
particle_from_config(c, parent_font),
|
||||
date_format != NULL ? yml_value_as_string(date_format) : "%x",
|
||||
time_format != NULL ? yml_value_as_string(time_format) : "%H:%M");
|
||||
}
|
||||
|
||||
static struct module *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue