mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-15 16:05:38 +02:00
decorations: are now plugins
This commit is contained in:
parent
4eee71eaf4
commit
7754ef3661
11 changed files with 160 additions and 124 deletions
17
plugin.c
17
plugin.c
|
@ -15,8 +15,9 @@ static const char *
|
|||
type2str(enum plugin_type type)
|
||||
{
|
||||
switch (type) {
|
||||
case PLUGIN_MODULE: return "module";
|
||||
case PLUGIN_PARTICLE: return "particle";
|
||||
case PLUGIN_MODULE: return "module";
|
||||
case PLUGIN_PARTICLE: return "particle";
|
||||
case PLUGIN_DECORATION: return "decoration";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -53,10 +54,9 @@ plugin_load(const char *name, enum plugin_type type)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
char path[128];
|
||||
snprintf(
|
||||
path, sizeof(path), "%s_%s.so",
|
||||
type == PLUGIN_MODULE ? "module" : "particle", name);
|
||||
snprintf(path, sizeof(path), "%s_%s.so", type2str(type), name);
|
||||
|
||||
/* Not loaded - do it now */
|
||||
void *lib = dlopen(path, RTLD_LOCAL | RTLD_NOW);
|
||||
|
@ -102,3 +102,10 @@ plugin_load_particle(const char *name)
|
|||
const struct plugin *plug = plugin_load(name, PLUGIN_PARTICLE);
|
||||
return plug != NULL ? &plug->particle : NULL;
|
||||
}
|
||||
|
||||
const struct deco_iface *
|
||||
plugin_load_deco(const char *name)
|
||||
{
|
||||
const struct plugin *plug = plugin_load(name, PLUGIN_DECORATION);
|
||||
return plug != NULL ? &plug->decoration : NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue