mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
module/xkb: monitor current xkb layout
This commit is contained in:
parent
d600960d69
commit
ef594b877b
4 changed files with 497 additions and 0 deletions
13
config.c
13
config.c
|
@ -18,6 +18,7 @@
|
|||
#include "modules/clock/clock.h"
|
||||
#include "modules/i3/i3.h"
|
||||
#include "modules/label/label.h"
|
||||
#include "modules/xkb/xkb.h"
|
||||
#include "modules/xwindow/xwindow.h"
|
||||
|
||||
static uint8_t
|
||||
|
@ -315,6 +316,16 @@ module_battery_from_config(const struct yml_node *node,
|
|||
poll_interval != NULL ? yml_value_as_int(poll_interval) : 30);
|
||||
}
|
||||
|
||||
static struct module *
|
||||
module_xkb_from_config(const struct yml_node *node,
|
||||
const struct font *parent_font)
|
||||
{
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
assert(yml_is_dict(c));
|
||||
|
||||
return module_xkb(particle_from_config(c, parent_font));
|
||||
}
|
||||
|
||||
struct bar *
|
||||
conf_to_bar(const struct yml_node *bar)
|
||||
{
|
||||
|
@ -419,6 +430,8 @@ conf_to_bar(const struct yml_node *bar)
|
|||
mods[idx] = module_i3_from_config(it.node, font);
|
||||
else if (strcmp(mod_name, "battery") == 0)
|
||||
mods[idx] = module_battery_from_config(it.node, font);
|
||||
else if (strcmp(mod_name, "xkb") == 0)
|
||||
mods[idx] = module_xkb_from_config(it.node, font);
|
||||
else
|
||||
assert(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue