mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-22 20:25:39 +02:00
module/xkb: lock in content, and handle no layout available
This commit is contained in:
parent
825b0a16f8
commit
f04ff31d0f
1 changed files with 15 additions and 2 deletions
|
@ -55,13 +55,26 @@ content(struct module *mod)
|
||||||
{
|
{
|
||||||
const struct private *m = mod->private;
|
const struct private *m = mod->private;
|
||||||
|
|
||||||
|
mtx_lock(&mod->lock);
|
||||||
|
|
||||||
|
const char *name = "";
|
||||||
|
const char *symbol = "";
|
||||||
|
|
||||||
|
if (m->current < m->layouts.count) {
|
||||||
|
name = m->layouts.layouts[m->current].name;
|
||||||
|
symbol = m->layouts.layouts[m->current].symbol;
|
||||||
|
}
|
||||||
|
|
||||||
struct tag_set tags = {
|
struct tag_set tags = {
|
||||||
.tags = (struct tag *[]){
|
.tags = (struct tag *[]){
|
||||||
tag_new_string(mod, "name", m->layouts.layouts[m->current].name),
|
tag_new_string(mod, "name", name),
|
||||||
tag_new_string(mod, "symbol", m->layouts.layouts[m->current].symbol)},
|
tag_new_string(mod, "symbol", symbol),
|
||||||
|
},
|
||||||
.count = 2,
|
.count = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mtx_unlock(&mod->lock);
|
||||||
|
|
||||||
struct exposable *exposable = m->label->instantiate(m->label, &tags);
|
struct exposable *exposable = m->label->instantiate(m->label, &tags);
|
||||||
|
|
||||||
tag_set_destroy(&tags);
|
tag_set_destroy(&tags);
|
||||||
|
|
Loading…
Add table
Reference in a new issue