aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-12-03 12:59:28 +0100
committerFederico Angelilli <code@fedang.net>2024-12-03 12:59:28 +0100
commitf139b5f479e2bb04dbd41d97906b2fd48a608f8b (patch)
treeeb762ff52205c06b6b3b0a2a29a825bb03a847e9 /src/config.c
parent5a133f95105a494b9c6131132dcde27305b32a05 (diff)
Define constraints
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/src/config.c b/src/config.c
index 6f66cd4..43b7928 100644
--- a/src/config.c
+++ b/src/config.c
@@ -15,20 +15,20 @@
#include "any_ini.h"
const config_entry_t bar_entries[] = {
- { "override-redirect", CONFIG_BOOL, NULL, offsetof(config_t, override_redirect) },
- { "action-strict-run", CONFIG_BOOL, NULL, offsetof(config_t, action_strict_run) },
- { "action-strict-set", CONFIG_BOOL, NULL, offsetof(config_t, action_strict_set) },
- { "action-fail-fast", CONFIG_BOOL, NULL, offsetof(config_t, action_failfast) },
- { "wm-name", CONFIG_STRING, NULL, offsetof(config_t, wm_name) },
- { "wm-struts", CONFIG_BOOL, NULL, offsetof(config_t, wm_struts) },
- { "background", CONFIG_GRADIENT, NULL, offsetof(config_t, background) },
- { "font", CONFIG_STRING, NULL, offsetof(config_t, font) },
- { "monitor", CONFIG_STRING, NULL, offsetof(config_t, monitor) },
- { "width", CONFIG_UINT, NULL, offsetof(config_t, width) },
- { "height", CONFIG_UINT, NULL, offsetof(config_t, height) },
- { "x-offset", CONFIG_UINT, NULL, offsetof(config_t, x_offset) },
- { "y-offset", CONFIG_UINT, NULL, offsetof(config_t, y_offset) },
- { "scale", CONFIG_DOUBLE, NULL, offsetof(config_t, scale) },
+ { "override-redirect", CONFIG_BOOL, NULL, NULL, offsetof(config_t, override_redirect) },
+ { "action-strict-run", CONFIG_BOOL, NULL, NULL, offsetof(config_t, action_strict_run) },
+ { "action-strict-set", CONFIG_BOOL, NULL, NULL, offsetof(config_t, action_strict_set) },
+ { "action-fail-fast", CONFIG_BOOL, NULL, NULL, offsetof(config_t, action_failfast) },
+ { "wm-name", CONFIG_STRING, NULL, NULL, offsetof(config_t, wm_name) },
+ { "wm-struts", CONFIG_BOOL, NULL, NULL, offsetof(config_t, wm_struts) },
+ { "background", CONFIG_GRADIENT, NULL, NULL, offsetof(config_t, background) },
+ { "font", CONFIG_STRING, NULL, NULL, offsetof(config_t, font) },
+ { "monitor", CONFIG_STRING, NULL, NULL, offsetof(config_t, monitor) },
+ { "width", CONFIG_UINT, NULL, NULL, offsetof(config_t, width) },
+ { "height", CONFIG_UINT, NULL, NULL, offsetof(config_t, height) },
+ { "x-offset", CONFIG_UINT, NULL, NULL, offsetof(config_t, x_offset) },
+ { "y-offset", CONFIG_UINT, NULL, NULL, offsetof(config_t, y_offset) },
+ { "scale", CONFIG_DOUBLE, NULL, NULL, offsetof(config_t, scale) },
{ 0 },
};
@@ -40,39 +40,39 @@ const config_enum_t text_align_enum[] = {
};
const config_entry_t block_entries[] = {
- { "hidden", CONFIG_BOOL, NULL, offsetof(block_t, hidden) },
- { "color", CONFIG_GRADIENT, NULL, offsetof(block_t, bg_color) },
- { "line-color", CONFIG_GRADIENT, NULL, offsetof(block_t, line_color) },
- { "line-width", CONFIG_UINT, NULL, offsetof(block_t, line_width) },
- { "x-padding", CONFIG_UINT, NULL, offsetof(block_t, x_padding) },
- { "y-padding", CONFIG_UINT, NULL, offsetof(block_t, y_padding) },
- { "min-width", CONFIG_UINT, NULL, offsetof(block_t, min_width) },
- { "max-width", CONFIG_UINT, NULL, offsetof(block_t, max_width) },
- { "interval", CONFIG_TIME, NULL, offsetof(block_t, update_interval) },
- { "trigger", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_TRIGGER]) },
- { "left-click", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_LEFT_CLICK]) },
- { "middle-click", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_MIDDLE_CLICK]) },
- { "right-click", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_RIGHT_CLICK]) },
- { "scroll-up", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_SCROLL_UP]) },
- { "scroll-down", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_SCROLL_DOWN]) },
- { "hover-start", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_HOVER_START]) },
- { "hover-move", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_HOVER_MOVE]) },
- { "hover-stop", CONFIG_STRING, NULL, offsetof(block_t, actions[EVENT_HOVER_STOP]) },
+ { "hidden", CONFIG_BOOL, NULL, NULL, offsetof(block_t, hidden) },
+ { "color", CONFIG_GRADIENT, NULL, NULL, offsetof(block_t, bg_color) },
+ { "line-color", CONFIG_GRADIENT, NULL, NULL, offsetof(block_t, line_color) },
+ { "line-width", CONFIG_UINT, NULL, NULL, offsetof(block_t, line_width) },
+ { "x-padding", CONFIG_UINT, NULL, NULL, offsetof(block_t, x_padding) },
+ { "y-padding", CONFIG_UINT, NULL, NULL, offsetof(block_t, y_padding) },
+ { "min-width", CONFIG_UINT, NULL, NULL, offsetof(block_t, min_width) },
+ { "max-width", CONFIG_UINT, NULL, NULL, offsetof(block_t, max_width) },
+ { "interval", CONFIG_TIME, NULL, NULL, offsetof(block_t, update_interval) },
+ { "trigger", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_TRIGGER]) },
+ { "left-click", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_LEFT_CLICK]) },
+ { "middle-click", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_MIDDLE_CLICK]) },
+ { "right-click", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_RIGHT_CLICK]) },
+ { "scroll-up", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_SCROLL_UP]) },
+ { "scroll-down", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_SCROLL_DOWN]) },
+ { "hover-start", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_HOVER_START]) },
+ { "hover-move", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_HOVER_MOVE]) },
+ { "hover-stop", CONFIG_STRING, NULL, NULL, offsetof(block_t, actions[EVENT_HOVER_STOP]) },
{ 0 },
};
const config_entry_t block_group_entries[] = {
- { "spacing", CONFIG_UINT, NULL, offsetof(block_group_t, spacing) },
- { "blocks", CONFIG_LIST, NULL, offsetof(block_group_t, children) },
- { "collapse", CONFIG_BOOL, NULL, offsetof(block_group_t, collapse) },
+ { "spacing", CONFIG_UINT, NULL, NULL, offsetof(block_group_t, spacing) },
+ { "blocks", CONFIG_LIST, NULL, NULL, offsetof(block_group_t, children) },
+ { "collapse", CONFIG_BOOL, NULL, NULL, offsetof(block_group_t, collapse) },
{ 0 },
};
const config_entry_t block_text_entries[] = {
- { "text", CONFIG_STRING, NULL, offsetof(block_text_t, text) },
- { "text-color", CONFIG_COLOR, NULL, offsetof(block_text_t, text_color) },
- { "text-size", CONFIG_UINT, NULL, offsetof(block_text_t, text_size) },
- { "text-align", CONFIG_ENUM, text_align_enum, offsetof(block_text_t, text_size) },
+ { "text", CONFIG_STRING, NULL, NULL, offsetof(block_text_t, text) },
+ { "text-color", CONFIG_COLOR, NULL, NULL, offsetof(block_text_t, text_color) },
+ { "text-size", CONFIG_UINT, NULL, NULL, offsetof(block_text_t, text_size) },
+ { "text-align", CONFIG_ENUM, text_align_enum, NULL, offsetof(block_text_t, text_size) },
{ 0 },
};
@@ -710,6 +710,7 @@ int config_read(config_t *config, FILE *file)
case CONFIG_SUCCESS:
if (result != NULL && found != NULL) {
result += found->offset;
+
log_value_debug("Parsed entry",
"s:key", key,
"g:value", config_formatters[found->type], result,