forked from external/yambar
commit
9f2197ca1c
18 changed files with 65 additions and 47 deletions
|
@ -36,6 +36,10 @@
|
||||||
“refreshed” it (https://codeberg.org/dnkl/yambar/issues/116).
|
“refreshed” it (https://codeberg.org/dnkl/yambar/issues/116).
|
||||||
* network: failure to retrieve wireless attributes (SSID, RX/TX
|
* network: failure to retrieve wireless attributes (SSID, RX/TX
|
||||||
bitrate, signal strength etc).
|
bitrate, signal strength etc).
|
||||||
|
* Integer options that were supposed to be >= 0 were incorrectly
|
||||||
|
allowed, leading to various bad things; including yambar crashing,
|
||||||
|
or worse, the compositor crashing
|
||||||
|
(https://codeberg.org/dnkl/yambar/issues/129).
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
@ -1025,7 +1025,8 @@ setup(struct bar *_bar)
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
|
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
|
||||||
top_or_bottom);
|
top_or_bottom);
|
||||||
|
|
||||||
update_size(backend);
|
if (!update_size(backend))
|
||||||
|
return false;
|
||||||
|
|
||||||
assert(backend->monitor == NULL ||
|
assert(backend->monitor == NULL ||
|
||||||
backend->width / backend->monitor->scale <= backend->monitor->width_px);
|
backend->width / backend->monitor->scale <= backend->monitor->width_px);
|
||||||
|
|
|
@ -50,6 +50,17 @@ conf_verify_int(keychain_t *chain, const struct yml_node *node)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
conf_verify_unsigned(keychain_t *chain, const struct yml_node *node)
|
||||||
|
{
|
||||||
|
if (yml_value_is_int(node) && yml_value_as_int(node) >= 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
LOG_ERR("%s: value is not a positive integer: '%s'",
|
||||||
|
conf_err_prefix(chain, node), yml_value_as_string(node));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
conf_verify_bool(keychain_t *chain, const struct yml_node *node)
|
conf_verify_bool(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
|
@ -381,17 +392,17 @@ static bool
|
||||||
verify_bar_border(keychain_t *chain, const struct yml_node *node)
|
verify_bar_border(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"width", false, &conf_verify_int},
|
{"width", false, &conf_verify_unsigned},
|
||||||
{"left-width", false, &conf_verify_int},
|
{"left-width", false, &conf_verify_unsigned},
|
||||||
{"right-width", false, &conf_verify_int},
|
{"right-width", false, &conf_verify_unsigned},
|
||||||
{"top-width", false, &conf_verify_int},
|
{"top-width", false, &conf_verify_unsigned},
|
||||||
{"bottom-width", false, &conf_verify_int},
|
{"bottom-width", false, &conf_verify_unsigned},
|
||||||
{"color", false, &conf_verify_color},
|
{"color", false, &conf_verify_color},
|
||||||
{"margin", false, &conf_verify_int},
|
{"margin", false, &conf_verify_unsigned},
|
||||||
{"left-margin", false, &conf_verify_int},
|
{"left-margin", false, &conf_verify_unsigned},
|
||||||
{"right-margin", false, &conf_verify_int},
|
{"right-margin", false, &conf_verify_unsigned},
|
||||||
{"top-margin", false, &conf_verify_int},
|
{"top-margin", false, &conf_verify_unsigned},
|
||||||
{"bottom-margin", false, &conf_verify_int},
|
{"bottom-margin", false, &conf_verify_unsigned},
|
||||||
{NULL, false, NULL},
|
{NULL, false, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -422,20 +433,20 @@ conf_verify_bar(const struct yml_node *bar)
|
||||||
chain_push(&chain, "bar");
|
chain_push(&chain, "bar");
|
||||||
|
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"height", true, &conf_verify_int},
|
{"height", true, &conf_verify_unsigned},
|
||||||
{"location", true, &verify_bar_location},
|
{"location", true, &verify_bar_location},
|
||||||
{"background", true, &conf_verify_color},
|
{"background", true, &conf_verify_color},
|
||||||
|
|
||||||
{"monitor", false, &conf_verify_string},
|
{"monitor", false, &conf_verify_string},
|
||||||
{"layer", false, &verify_bar_layer},
|
{"layer", false, &verify_bar_layer},
|
||||||
|
|
||||||
{"spacing", false, &conf_verify_int},
|
{"spacing", false, &conf_verify_unsigned},
|
||||||
{"left-spacing", false, &conf_verify_int},
|
{"left-spacing", false, &conf_verify_unsigned},
|
||||||
{"right-spacing", false, &conf_verify_int},
|
{"right-spacing", false, &conf_verify_unsigned},
|
||||||
|
|
||||||
{"margin", false, &conf_verify_int},
|
{"margin", false, &conf_verify_unsigned},
|
||||||
{"left-margin", false, &conf_verify_int},
|
{"left-margin", false, &conf_verify_unsigned},
|
||||||
{"right-margin", false, &conf_verify_int},
|
{"right-margin", false, &conf_verify_unsigned},
|
||||||
|
|
||||||
{"border", false, &verify_bar_border},
|
{"border", false, &verify_bar_border},
|
||||||
{"font", false, &conf_verify_font},
|
{"font", false, &conf_verify_font},
|
||||||
|
@ -445,7 +456,7 @@ conf_verify_bar(const struct yml_node *bar)
|
||||||
{"center", false, &verify_module_list},
|
{"center", false, &verify_module_list},
|
||||||
{"right", false, &verify_module_list},
|
{"right", false, &verify_module_list},
|
||||||
|
|
||||||
{"trackpad-sensitivity", false, &conf_verify_int},
|
{"trackpad-sensitivity", false, &conf_verify_unsigned},
|
||||||
|
|
||||||
{NULL, false, NULL},
|
{NULL, false, NULL},
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,6 +32,7 @@ const char *conf_err_prefix(
|
||||||
|
|
||||||
bool conf_verify_string(keychain_t *chain, const struct yml_node *node);
|
bool conf_verify_string(keychain_t *chain, const struct yml_node *node);
|
||||||
bool conf_verify_int(keychain_t *chain, const struct yml_node *node);
|
bool conf_verify_int(keychain_t *chain, const struct yml_node *node);
|
||||||
|
bool conf_verify_unsigned(keychain_t *chain, const struct yml_node *node);
|
||||||
bool conf_verify_bool(keychain_t *chain, const struct yml_node *node);
|
bool conf_verify_bool(keychain_t *chain, const struct yml_node *node);
|
||||||
|
|
||||||
bool conf_verify_enum(keychain_t *chain, const struct yml_node *node,
|
bool conf_verify_enum(keychain_t *chain, const struct yml_node *node,
|
||||||
|
|
|
@ -76,7 +76,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"color", true, &conf_verify_color},
|
{"color", true, &conf_verify_color},
|
||||||
{"size", false, &conf_verify_int},
|
{"size", false, &conf_verify_unsigned},
|
||||||
DECORATION_COMMON_ATTRS,
|
DECORATION_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ static bool
|
||||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"size", true, &conf_verify_int},
|
{"size", true, &conf_verify_unsigned},
|
||||||
{"color", true, &conf_verify_color},
|
{"color", true, &conf_verify_color},
|
||||||
DECORATION_COMMON_ATTRS,
|
DECORATION_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,6 +77,7 @@ User defined.
|
||||||
: Arguments to pass to the script/binary.
|
: Arguments to pass to the script/binary.
|
||||||
| poll-interval
|
| poll-interval
|
||||||
: integer
|
: integer
|
||||||
|
: no
|
||||||
: Number of seconds between each script run. If unset, continuous mode
|
: Number of seconds between each script run. If unset, continuous mode
|
||||||
is used.
|
is used.
|
||||||
|
|
||||||
|
|
|
@ -496,7 +496,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"name", true, &conf_verify_string},
|
{"name", true, &conf_verify_string},
|
||||||
{"poll-interval", false, &conf_verify_int},
|
{"poll-interval", false, &conf_verify_unsigned},
|
||||||
MODULE_COMMON_ATTRS,
|
MODULE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -878,9 +878,9 @@ static bool
|
||||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"spacing", false, &conf_verify_int},
|
{"spacing", false, &conf_verify_unsigned},
|
||||||
{"left-spacing", false, &conf_verify_int},
|
{"left-spacing", false, &conf_verify_unsigned},
|
||||||
{"right-spacing", false, &conf_verify_int},
|
{"right-spacing", false, &conf_verify_unsigned},
|
||||||
{"sort", false, &verify_sort},
|
{"sort", false, &verify_sort},
|
||||||
{"persistent", false, &verify_persistent},
|
{"persistent", false, &verify_persistent},
|
||||||
{"content", true, &verify_content},
|
{"content", true, &verify_content},
|
||||||
|
|
|
@ -616,7 +616,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"host", true, &conf_verify_string},
|
{"host", true, &conf_verify_string},
|
||||||
{"port", false, &conf_verify_int},
|
{"port", false, &conf_verify_unsigned},
|
||||||
MODULE_COMMON_ATTRS,
|
MODULE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1257,7 +1257,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"name", true, &conf_verify_string},
|
{"name", true, &conf_verify_string},
|
||||||
{"poll-interval", false, &conf_verify_int},
|
{"poll-interval", false, &conf_verify_unsigned},
|
||||||
MODULE_COMMON_ATTRS,
|
MODULE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -652,9 +652,9 @@ static bool
|
||||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"spacing", false, &conf_verify_int},
|
{"spacing", false, &conf_verify_unsigned},
|
||||||
{"left-spacing", false, &conf_verify_int},
|
{"left-spacing", false, &conf_verify_unsigned},
|
||||||
{"right-spacing", false, &conf_verify_int},
|
{"right-spacing", false, &conf_verify_unsigned},
|
||||||
{"ignore", false, &verify_ignore},
|
{"ignore", false, &verify_ignore},
|
||||||
MODULE_COMMON_ATTRS,
|
MODULE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
|
@ -709,7 +709,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"path", true, &conf_verify_path},
|
{"path", true, &conf_verify_path},
|
||||||
{"args", false, &conf_verify_args},
|
{"args", false, &conf_verify_args},
|
||||||
{"poll-interval", false, &conf_verify_int},
|
{"poll-interval", false, &conf_verify_unsigned},
|
||||||
MODULE_COMMON_ATTRS,
|
MODULE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -374,9 +374,9 @@ static bool
|
||||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"spacing", false, &conf_verify_int},
|
{"spacing", false, &conf_verify_unsigned},
|
||||||
{"left-spacing", false, &conf_verify_int},
|
{"left-spacing", false, &conf_verify_unsigned},
|
||||||
{"right-spacing", false, &conf_verify_int},
|
{"right-spacing", false, &conf_verify_unsigned},
|
||||||
{"identifiers", true, &verify_identifiers},
|
{"identifiers", true, &verify_identifiers},
|
||||||
MODULE_COMMON_ATTRS,
|
MODULE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
16
particle.h
16
particle.h
|
@ -76,12 +76,12 @@ void exposable_default_on_mouse(
|
||||||
enum mouse_event event, enum mouse_button btn, int x, int y);
|
enum mouse_event event, enum mouse_button btn, int x, int y);
|
||||||
|
|
||||||
/* List of attributes *all* particles implement */
|
/* List of attributes *all* particles implement */
|
||||||
#define PARTICLE_COMMON_ATTRS \
|
#define PARTICLE_COMMON_ATTRS \
|
||||||
{"margin", false, &conf_verify_int}, \
|
{"margin", false, &conf_verify_unsigned}, \
|
||||||
{"left-margin", false, &conf_verify_int}, \
|
{"left-margin", false, &conf_verify_unsigned}, \
|
||||||
{"right-margin", false, &conf_verify_int}, \
|
{"right-margin", false, &conf_verify_unsigned}, \
|
||||||
{"on-click", false, &conf_verify_on_click}, \
|
{"on-click", false, &conf_verify_on_click}, \
|
||||||
{"font", false, &conf_verify_font}, \
|
{"font", false, &conf_verify_font}, \
|
||||||
{"foreground", false, &conf_verify_color}, \
|
{"foreground", false, &conf_verify_color}, \
|
||||||
{"deco", false, &conf_verify_decoration}, \
|
{"deco", false, &conf_verify_decoration}, \
|
||||||
{NULL, false, NULL}
|
{NULL, false, NULL}
|
||||||
|
|
|
@ -208,9 +208,9 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"items", true, &conf_verify_particle_list_items},
|
{"items", true, &conf_verify_particle_list_items},
|
||||||
{"spacing", false, &conf_verify_int},
|
{"spacing", false, &conf_verify_unsigned},
|
||||||
{"left-spacing", false, &conf_verify_int},
|
{"left-spacing", false, &conf_verify_unsigned},
|
||||||
{"right-spacing", false, &conf_verify_int},
|
{"right-spacing", false, &conf_verify_unsigned},
|
||||||
PARTICLE_COMMON_ATTRS,
|
PARTICLE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"tag", true, &conf_verify_string},
|
{"tag", true, &conf_verify_string},
|
||||||
{"length", true, &conf_verify_int},
|
{"length", true, &conf_verify_unsigned},
|
||||||
/* TODO: make these optional? Default to empty */
|
/* TODO: make these optional? Default to empty */
|
||||||
{"start", true, &conf_verify_particle},
|
{"start", true, &conf_verify_particle},
|
||||||
{"end", true, &conf_verify_particle},
|
{"end", true, &conf_verify_particle},
|
||||||
|
|
|
@ -323,7 +323,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||||
{
|
{
|
||||||
static const struct attr_info attrs[] = {
|
static const struct attr_info attrs[] = {
|
||||||
{"text", true, &conf_verify_string},
|
{"text", true, &conf_verify_string},
|
||||||
{"max", false, &conf_verify_int},
|
{"max", false, &conf_verify_unsigned},
|
||||||
PARTICLE_COMMON_ATTRS,
|
PARTICLE_COMMON_ATTRS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue