Add set-hook -B install a subscription like in control mode.

Subscriptions are formats which are checked once a second and if changed
invoke a hook. show-hooks -B lists.
This commit is contained in:
nicm
2026-07-05 08:24:00 +00:00
parent 7a8f8f5a74
commit de024e04d7
9 changed files with 607 additions and 117 deletions

View File

@@ -56,6 +56,7 @@ struct options_entry {
int cached;
struct style style;
void *monitor_data;
RB_ENTRY(options_entry) entry;
};
@@ -354,6 +355,8 @@ options_remove(struct options_entry *o)
options_array_clear(o);
else
options_value_free(o, &o->value);
if (o->monitor_data != NULL)
notify_monitor_free(o->monitor_data);
RB_REMOVE(options_tree, &oo->tree, o);
free((void *)o->name);
free(o);
@@ -371,6 +374,18 @@ options_owner(struct options_entry *o)
return (o->owner);
}
void *
options_get_monitor_data(struct options_entry *o)
{
return (o->monitor_data);
}
void
options_set_monitor_data(struct options_entry *o, void *data)
{
o->monitor_data = data;
}
const struct options_table_entry *
options_table_entry(struct options_entry *o)
{