forked from external/yambar
modules: implement description()
This commit is contained in:
parent
97d5570daf
commit
ed2b8c4874
14 changed files with 116 additions and 0 deletions
|
@ -39,6 +39,15 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
static char desc[32];
|
||||||
|
struct private *m = mod->private;
|
||||||
|
snprintf(desc, sizeof(desc), "alsa(%s)", m->card);
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -287,6 +296,7 @@ alsa_new(const char *card, const char *mixer, struct particle *label)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "backlight";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -216,6 +222,7 @@ backlight_new(const char *device, struct particle *label)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,15 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
static char desc[32];
|
||||||
|
struct private *m = mod->private;
|
||||||
|
snprintf(desc, sizeof(desc), "bat(%s)", m->battery);
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -462,6 +471,7 @@ battery_new(const char *battery, struct particle *label, int poll_interval_secs)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "clock";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -60,6 +66,7 @@ content(struct module *mod)
|
||||||
return exposable;
|
return exposable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
static int
|
static int
|
||||||
run(struct module *mod)
|
run(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -161,6 +168,7 @@ clock_new(struct particle *label, const char *date_format, const char *time_form
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -608,6 +608,12 @@ ws_content_for_name(struct private *m, const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "i3/sway";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -710,6 +716,7 @@ i3_new(struct i3_workspaces workspaces[], size_t workspace_count,
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "label";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +51,7 @@ label_new(struct particle *label)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "mpd";
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t
|
static uint64_t
|
||||||
timespec_diff_milli_seconds(const struct timespec *a, const struct timespec *b)
|
timespec_diff_milli_seconds(const struct timespec *a, const struct timespec *b)
|
||||||
{
|
{
|
||||||
|
@ -588,6 +594,7 @@ mpd_new(const char *host, uint16_t port, struct particle *label)
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
mod->refresh_in = &refresh_in;
|
mod->refresh_in = &refresh_in;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,16 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
static char desc[32];
|
||||||
|
struct private *m = mod->private;
|
||||||
|
|
||||||
|
snprintf(desc, sizeof(desc), "net(%s)", m->iface);
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -526,6 +536,7 @@ network_new(const char *iface, struct particle *label)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "removables";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -596,6 +602,7 @@ removables_new(struct particle *label, int left_spacing, int right_spacing,
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "river";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -645,6 +651,7 @@ river_new(struct particle *template, struct particle *title)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
m->mod = mod;
|
m->mod = mod;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,19 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
static char desc[32];
|
||||||
|
struct private *m = mod->private;
|
||||||
|
|
||||||
|
char *path = strdup(m->path);
|
||||||
|
snprintf(desc, sizeof(desc), "script(%s)", basename(path));
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -569,6 +582,7 @@ script_new(const char *path, size_t argc, const char *const argv[static argc],
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "sway-xkb";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -307,6 +313,7 @@ sway_xkb_new(struct particle *template, const char *identifiers[],
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,12 @@ destroy(struct module *mod)
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "xkb";
|
||||||
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
content(struct module *mod)
|
content(struct module *mod)
|
||||||
{
|
{
|
||||||
|
@ -650,6 +656,7 @@ xkb_new(struct particle *label)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,12 @@ struct private {
|
||||||
xcb_window_t active_win;
|
xcb_window_t active_win;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
description(struct module *mod)
|
||||||
|
{
|
||||||
|
return "xwindow";
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_active_window(struct private *m)
|
update_active_window(struct private *m)
|
||||||
{
|
{
|
||||||
|
@ -332,6 +338,7 @@ xwindow_new(struct particle *label)
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
|
mod->description = &description;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue