mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-21 11:55:42 +02:00
module/pipewire: add spacing config
This commit is contained in:
parent
fc24ea225d
commit
21f374d2eb
2 changed files with 31 additions and 3 deletions
|
@ -43,6 +43,18 @@ pipewire - Monitors pipewire for volume, mute/unmute, device change
|
||||||
:[ *Type*
|
:[ *Type*
|
||||||
:[ *Req*
|
:[ *Req*
|
||||||
:< *Description*
|
:< *Description*
|
||||||
|
| left-spacing
|
||||||
|
: int
|
||||||
|
: no
|
||||||
|
: Space, in pixels, in the left side of each rendered volume
|
||||||
|
| right-spacing
|
||||||
|
: int
|
||||||
|
: no
|
||||||
|
: Space, in pixels, on the right side of each rendered volume
|
||||||
|
| spacing
|
||||||
|
: int
|
||||||
|
: no
|
||||||
|
: Short-hand for setting both _left-spacing_ and _right-spacing_
|
||||||
| content
|
| content
|
||||||
: particle
|
: particle
|
||||||
: yes
|
: yes
|
||||||
|
|
|
@ -60,6 +60,8 @@ struct private
|
||||||
{
|
{
|
||||||
struct particle *label;
|
struct particle *label;
|
||||||
struct data *data;
|
struct data *data;
|
||||||
|
int left_spacing;
|
||||||
|
int right_spacing;
|
||||||
|
|
||||||
/* pipewire related */
|
/* pipewire related */
|
||||||
struct output_informations sink_informations;
|
struct output_informations sink_informations;
|
||||||
|
@ -918,7 +920,7 @@ content(struct module *module)
|
||||||
|
|
||||||
mtx_unlock(&module->lock);
|
mtx_unlock(&module->lock);
|
||||||
|
|
||||||
return dynlist_exposable_new(exposables, exposables_length, 0, 0);
|
return dynlist_exposable_new(exposables, exposables_length, private->left_spacing, private->right_spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -965,11 +967,13 @@ run(struct module *module)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct module *
|
static struct module *
|
||||||
pipewire_new(struct particle *label)
|
pipewire_new(struct particle *label, int left_spacing, int right_spacing)
|
||||||
{
|
{
|
||||||
struct private *private = calloc(1, sizeof(struct private));
|
struct private *private = calloc(1, sizeof(struct private));
|
||||||
assert(private != NULL);
|
assert(private != NULL);
|
||||||
private->label = label;
|
private->label = label;
|
||||||
|
private->left_spacing = left_spacing;
|
||||||
|
private->right_spacing = right_spacing;
|
||||||
|
|
||||||
struct module *module = module_common_new();
|
struct module *module = module_common_new();
|
||||||
module->private = private;
|
module->private = private;
|
||||||
|
@ -987,13 +991,25 @@ static struct module *
|
||||||
from_conf(struct yml_node const *node, struct conf_inherit inherited)
|
from_conf(struct yml_node const *node, struct conf_inherit inherited)
|
||||||
{
|
{
|
||||||
struct yml_node const *content = yml_get_value(node, "content");
|
struct yml_node const *content = yml_get_value(node, "content");
|
||||||
return pipewire_new(conf_to_particle(content, inherited));
|
struct yml_node const *spacing = yml_get_value(node, "spacing");
|
||||||
|
struct yml_node const *left_spacing = yml_get_value(node, "left-spacing");
|
||||||
|
struct yml_node const *right_spacing = yml_get_value(node, "right-spacing");
|
||||||
|
|
||||||
|
int left = spacing != NULL ? yml_value_as_int(spacing) : left_spacing != NULL ? yml_value_as_int(left_spacing) : 0;
|
||||||
|
int right = spacing != NULL ? yml_value_as_int(spacing)
|
||||||
|
: right_spacing != NULL ? yml_value_as_int(right_spacing)
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
return pipewire_new(conf_to_particle(content, inherited), left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
verify_conf(keychain_t *keychain, struct yml_node const *node)
|
verify_conf(keychain_t *keychain, struct yml_node const *node)
|
||||||
{
|
{
|
||||||
static struct attr_info const attrs[] = {
|
static struct attr_info const attrs[] = {
|
||||||
|
{"spacing", false, &conf_verify_unsigned},
|
||||||
|
{"left-spacing", false, &conf_verify_unsigned},
|
||||||
|
{"right-spacing", false, &conf_verify_unsigned},
|
||||||
MODULE_COMMON_ATTRS,
|
MODULE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
return conf_verify_dict(keychain, node, attrs);
|
return conf_verify_dict(keychain, node, attrs);
|
||||||
|
|
Loading…
Add table
Reference in a new issue