From 416417a54c5875abcdc257b6ad10ff086c35eefc Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Sep 2016 08:18:37 -0400 Subject: Reorganize includes --- include/sway/criteria.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 include/sway/criteria.h (limited to 'include/sway/criteria.h') diff --git a/include/sway/criteria.h b/include/sway/criteria.h new file mode 100644 index 00000000..5c71d172 --- /dev/null +++ b/include/sway/criteria.h @@ -0,0 +1,36 @@ +#ifndef _SWAY_CRITERIA_H +#define _SWAY_CRITERIA_H + +#include "container.h" +#include "list.h" + +/** + * Maps criteria (as a list of criteria tokens) to a command list. + * + * A list of tokens together represent a single criteria string (e.g. + * '[class="abc" title="xyz"]' becomes two criteria tokens). + * + * for_window: Views matching all criteria will have the bound command list + * executed on them. + * + * Set via `for_window `. + */ +struct criteria { + list_t *tokens; // struct crit_token, contains compiled regex. + char *crit_raw; // entire criteria string (for logging) + + char *cmdlist; +}; + +int criteria_cmp(const void *item, const void *data); +void free_criteria(struct criteria *crit); + +// Pouplate list with crit_tokens extracted from criteria string, returns error +// string or NULL if successful. +char *extract_crit_tokens(list_t *tokens, const char *criteria); + +// Returns list of criteria that match given container. These criteria have +// been set with `for_window` commands and have an associated cmdlist. +list_t *criteria_for(swayc_t *cont); + +#endif -- cgit v1.2.3-54-g00ecf